I have a class which implements IHttpHandler that is designed to handle image resize requests. It handles Urls like so [URL] Currently the handler looks for myimg.jpg on disk, cuts a 100x100 thumbnail (if it isn't already present) and redirects the client to the thumbnail like so Response.RedirectPermanent("/some/virtualPath/to/thumbnail.jpg");
This has been working great, but I would like to avoid forcing the client to issue a second HTTP request. Is it safe to do the following? Server.Transfer("/some/virtualPath/to/thumbnail.jpg") All the MSDN documentation talks about using Server.Transfer() to redirect to an aspx page, so I'm not sure if this is the right thing to do or not.
I need to pass api key in custom http header ('X-ApiKey') and pass to another page. The second page will read that api key and do further processing. If api key is not passed in, it will redirect to error page.
Sometimes when transferring to a different page, I have to use response.redirect instead of server.transfer, and when I do, the name of the page always shows up in the url such as [URL]
I use server.transfer when I can, but unfortunately I haven't found a way to use it unless the transferred page refers back to the parent when leaving.
How can I mask what page is being viewed after doing a response.redirect to another page.
To get the url of the current page, I usually do something like this:string path = Request.Path;If I do this after a Server.Transfer then I get the path of the page where the transfer was done. How can I get it for the current page?For example:
On Page1.aspx I do Server.Transfer ("Page2.aspx") On Page2.aspx Request.Path returns /Page1.aspx and not /Page2.aspx
as u know, you can call Server.Transfer() or place some values in Session["objName"]=value; inside your page. but i'm writing a class which has not page, so it does not have any Server or Session object.
how can call this objects or methods outside of the page (within my class) ?
I have used a image handler to display image which works fine... My problem is how can v pass the image using sessions on different pages. I have an image control in master page and fileupload control on the content page.... bt m not able to implement sessions for images as image can't be store to string.
How would I transfer the values of an array created at runtime from one page to another? I tried using Response.Redirect because single values are getting transferred, but this isn't working properly with the array.
I am new at this VB/Microsoft Visual Web Developer 2010 Express thing. I am amaze that I even got this far and thatI manages to make this search page work. Below is the code and picture for this search page. It's working. However I want to transfer the result/the gridview onto a second page Result.aspx. But I tries all kind of thing and it just doesn't seem to want to cooperate with me. If anyone can give me some hint/some sample codes on how I might be able to transfer controlfrom one page onto another. I just have to learn it from a class extra credit project. Also in the picture above I am using a direct connection to an Access database not the ObjectDataSource. I was just playing around with it to see which is better. But I ended up going with direct connection to Access database.
<%@ Page Language="VB" ClassName="SenderClass" EnableSessionState="True" %> <head> <script runat="server"> Sub closeSite(ByVal sender As Object, ByVal e As EventArgs) Response.Write(" <script language='javascript'> { window.close(); }") End Sub Sub Page_Transfer(ByVal sender As Object, ByVal e As EventArgs) 'Storing in Context Session("SearchBox") = SearchBox.Text Session("ListBox") = ListBox1.Text Session("DropDownList") = DropDownList.DataTextFormatString 'Context.Items("DropDownList") = DropDownList.Text 'Server.Transfer("SearchResult.aspx") End Sub Sub Page_Transfer2(ByVal sender As Object, ByVal e As EventArgs) Dim field1 As String = ("SearchBox") Dim field2 As String = ("ListBox") Dim field3 As String = ("DropDownList") 'Dim TestString As String = ("SELECT * FROM [Books] WHERE (([Title] = ?) AND ([Category] = ?))") End Sub Sub Test(ByVal sender As Object, ByVal e As EventArgs) AccessDataSource1.SelectCommand = "SELECT * FROM BOOKS WHERE " If DropDownList.SelectedIndex = 0 Then AccessDataSource1.SelectCommand += String.Format(" ((Category = @Category OR 'Computer' ") AccessDataSource1.SelectCommand += String.Format(" OR 'Literature & Fiction' OR 'Reference'") AccessDataSource1.SelectCommand += String.Format(" OR 'Romance' OR 'Science'") AccessDataSource1.SelectCommand += String.Format(" OR 'Home Design' OR 'Accounting & Finance'") AccessDataSource1.SelectCommand += String.Format(" OR 'Horror' OR 'Refernce'))") Else AccessDataSource1.SelectCommand += String.Format("(( Category = @Category ))") End If For Each Item As ListItem In ListBox1.Items If Item.Selected = 0 Then AccessDataSource1.SelectCommand += String.Format(" AND ((Title Like @Search + '%'", Item.Text) AccessDataSource1.SelectCommand += String.Format(" OR [Author(s)] Like @Search + '%'", Item.Text) AccessDataSource1.SelectCommand += String.Format(" OR Publisher Like @Search + '%'", Item.Text) AccessDataSource1.SelectCommand += String.Format(" OR ISBN Like @Search + '%'", Item.Text) AccessDataSource1.SelectCommand += String.Format(" OR Price Like @Search + '%'", Item.Text) AccessDataSource1.SelectCommand += String.Format(" OR Category Like @Search + '%'", Item.Text) AccessDataSource1.SelectCommand += String.Format(" OR Year Like @Search + '%' ))", Item.Text) End If If Item.Selected = 1 Then AccessDataSource1.SelectCommand += String.Format(" AND (Title Like @Search + '%' )", Item.Text) End If If Item.Selected = 2 Then AccessDataSource1.SelectCommand += String.Format(" AND ([Author(s)] Like @Search + '%' )", Item.Text) End If If Item.Selected = 3 Then AccessDataSource1.SelectCommand += String.Format(" AND (Publisher Like @Search + '%' )", Item.Text) End If If Item.Selected = 4 Then AccessDataSource1.SelectCommand += String.Format(" AND (ISBN Like @Search + '%' )", Item.Text) End If If Item.Selected = 5 Then AccessDataSource1.SelectCommand += String.Format(" AND (Price Like @Search + '%' )", Item.Text) End If If Item.Selected = 6 Then AccessDataSource1.SelectCommand += String.Format(" AND (Category Like @Search + '%' )", Item.Text) End If If Item.Selected = 7 Then AccessDataSource1.SelectCommand += String.Format(" AND (Year Like @Search + '%' )", Item.Text) End If Next Dim KeywordCom As String = AccessDataSource1.SelectCommand.ToString Context.Items("Test") = KeywordCom.ToString Server.Transfer("Result.aspx") End Sub </script> </head> <html> <body> <a href="Default.aspx">Home</a> <a href="About.aspx">About.aspx</a><a href="SearchResult.aspx">SearchResult.aspx</a> <form id="form1" runat="server"> <h3> Search for: <asp:TextBox ID="SearchBox" runat="server" Width="219px" /> <asp:Button ID="Button1" Text="Search" Width="146px" AccessKey="S" runat="server" Enabled="True" Onclick="Test" height="26px" style="position: relative"/> </h3> <h3> Search In:<asp:ListBox ID="ListBox1" runat="server" style="margin-left: 6px" Width="221px"> <asp:ListItem>Keyword Anywhere</asp:ListItem> <asp:ListItem>Title</asp:ListItem> <asp:ListItem>Author(s)</asp:ListItem> <asp:ListItem>Publisher</asp:ListItem> <asp:ListItem>ISBN</asp:ListItem> <asp:ListItem>Price</asp:ListItem> <asp:ListItem>Category</asp:ListItem> <asp:ListItem>Year</asp:ListItem> </asp:ListBox> </h3> <h3> Category: <asp:DropDownList ID="DropDownList" runat="server" Height="16px" Width="162px"> <asp:ListItem>All Categories</asp:ListItem> <asp:ListItem>Computer</asp:ListItem> <asp:ListItem>Literature & Fiction</asp:ListItem> <asp:ListItem>Reference</asp:ListItem> <asp:ListItem>Romance</asp:ListItem> <asp:ListItem>Science</asp:ListItem> <asp:ListItem>Home Design</asp:ListItem> <asp:ListItem>Accounting & Finance</asp:ListItem> <asp:ListItem>Horror</asp:ListItem> </asp:DropDownList> <asp:Button ID="Button3" runat="server" Text="Exit Store" Width="146px" height="26px" /> </h3> <p> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="AccessDataSource1" > <Columns> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /> <asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" /> <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /> <asp:BoundField DataField="Author(s)" HeaderText="Author(s)" SortExpression="Author(s)" /> <asp:BoundField DataField="Publisher" HeaderText="Publisher" SortExpression="Publisher" /> <asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" /> <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" /> <asp:BoundField DataField="Category" HeaderText="Category" SortExpression="Category" /> <asp:ButtonField ButtonType="Button" CommandName="Select" HeaderText="Select" ShowHeader="True" Text="Select" runat="server" /> </Columns> </asp:GridView> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Books.accdb" > <SelectParameters> <asp:ControlParameter Name="Category" ControlID="DropDownList" PropertyName="SelectedValue" /> <asp:ControlParameter Name="Search" ControlID="SearchBox" PropertyName="Text" /> <asp:ControlParameter Name="InColumn" ControlID="ListBox1" PropertyName="SelectedValue" /> </SelectParameters> </asp:AccessDataSource> </p> <p> </p> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </form> </body> </html>
i am developing a login page.After matching there given and actual credentials i have to show there own private page.So which method should i use now.Which is better one ?Server.Transfer of Response.Redirect ?How can i access login page's data in the user's home page if i use Server.Transer method without using Session variable ?
i am creating a print view using checkboxes that a customer uses to select which items they wish to print. I am having difficulty transfering the selected gridview items to another page. I was using crosspage post.
I have created a new ASP.Net MVC 2.0 project.When I open the Site.Master and look at the navigation you have the following:
[Code]....
When clicking the link, it gives me a 404 file not found and my URL is the following: http://localhost:2053/Services.aspxHow can I create 4 simple html link that has the href property pointing to my 4 files inside my
I want to SELECT a user from a table using the WHERE clause. I know how to write the query, but how do I execute it and how do I match the UserId with the current one (how do I know what the current userid is using the login controls)? I basically want to display profile information by selecting the table and matching it to the userid.
I have this simple html page that talks to a microchip. It turns a LED light on and off.
[Code]....
**************
Can someone give me some pointers on how to convert the above to asp.net. I have put two asp:buttons on a webForm. Then for the button clickevent of the btnOn would I use something this like this? Or is WebRequest the wrong concept to use? I can seem to get this code to work for me!
i'm a begineer and i'm now learning how to develop a web page with asp.net in c# language.can anyone teach or show me a sample of login function which can put in my web page together with the page and database code.p/s: i do not use the MS sql server express in MS VS instead i using MS sql server 2005 as my database.