When I use Server.Transfer the browser keeps the Previous Page on the URL bar. Also, when I try to view the source code of the page, shows the previous page code. I need to see the current page code. Any help?
Thank you
In IE8 the developer toolbar allows you to view the original and current DOM of the page. In Firefox, you can use the Web Developer plugin to allow you to view the current page source.
If you use Response.Redirect() instead of Server.Transfer you have less of these problems though at the cost of having more round trips to your server.
Related
I want anyone browsing for "MyDomain.com" to see what's in "MyDomain.com/Folder1/HomePage.aspx".
I tried adding a page with <meta http-equiv="refresh" content="0;URL='MyDomain.com/Folder1/HomePage.aspx'" /> but there is a slight delay. I'd rather it is done silently.
I tried using iis-manager's HTTP-Redirect, but all sub-directories inherit it. (And asking here https://stackoverflow.com/questions/13629137/prevent-subdirectories-from-inheriting-an-http-redirect-in-iis about solving that returned mainly silent close-votes.)
So how do I achieve it?
Meta will take some time because it will first come to client, and then it will be transferred to the new page since HTML executes in browser - not on server.
The fastest method if to place use Server.Transfer("~/Folder1/HomePage.aspx") on your Default.aspx page. This will be executed on server as compared to Response.Redirect which also throws content back to browser first, then transfers to new page.
But the drawback of using Server.Transfer("~/Folder1/HomePage.aspx") is that it will not change the URL of the browser. I mean even you will be sitting on "MyDomain.com/Folder1/HomePage.aspx" but browser will be showing you the URL of previous page.
I hope this answers your question. If yes, then mark it as "answered".
What about trying something like this in the Default.aspx page load event?
Response.Status = "Redirecting"
Response.AddHeader("Location", "MyDomain.com/Folder1/HomePage.aspx")
Response.Redirect
Seems to be the best way.
I know the page reload concept via ajax without page refresh.
But facebook pages reload through normal page load. but sidebar's not loading just reload content area.
How is it possible?
Advance Thanks friends
Facebook uses bigpipe
The general idea is to decompose web pages into small chunks called pagelets, and pipeline them through several execution stages inside web servers and browsers. It is implemented entirely in PHP and JavaScript.
Clicking and taking some action on a webpage initialize/executes a pagelet, response generates from iframe or from ajax as well. Read the response and show it to a small chunk, this will not refresh the page.
I believe they are using the new history.pushState functionality in HTML5.
I'm bulding an ASP.NET website just to test my skills, and I'm using lots of callbacks that doesn't require a page refresh, and the URL doesn't change. In this example, assume I'm bulding a web-based Outlook with a treeview, a grid, and a detail pane.
Is there a standard (published or assumed) that says I should postback, or even update my URL from time to time?
The Standard you are probably looking for is called usability. DHTML, Ajax, or whatever you want to call it is fine until it breaks the users expectation of browser behavior. When the back button fails to work, and users can't bookmark the page exactly as they expect, you're doing it wrong.
I don't know about an official standard, but you may want to check out Gmail to see a good example of how something similar was done. The URL changes on the site much more often than the page refreshes.
I am working on screen scraping, its easy when filteration in query string, but the problem in AJAX based filteration,
e.g. here is an sample URL
When you open this page, enter hotel name and click Go, Ajax filter work and show the result accordingly or you click on Next Page, it will shown next record using AJAX based.
please suggest me, how to handle these kind of issues when working in Screen Scraping?
Thank alot
You may want to try 2 Firefox add-ons. They are "Firebug" and "Tamper Data".
The "Console" window of Firebug shows the AJAX request and response.
You can then write scripts using the PHP/cURL library to mimic the request.
Do a http request as you normally do for any link or form sumbit but use the url used with ajax. Sometimes you may need to read the javascript source to determine how the url is built.
Which one is better when we want to redirect to a new page in asp.net : using a link button and then Response.Redirect OR using an html link?
Depends on your needs:
Use the <a> tag if there's no need for you to do anything with the form/page you're directing from
use response.redirect if you need information from the form before moving on to the next page, for example to update session states or store intermediate results.
well an anchor tag elimates a round trip to the server.
If you are just linking to another page with a static URL, use an HTML anchor link. It will have better performance and only requires code in one place: the page.
If you need to perform operations on the server before the redirect, including manipulating the URL (e.g. dynamically creating querystring parameters), then use a server control (button, link, linkbutton).
I would use the anchor tag. It seems that with the redirect you are doing extra work with the round trip for not much gain besides using the link button control (at least this is what I am surmising from your question, there are valid reasons to use it). Also (not that this will likely make a difference in your case) it does cause and additional status code to be sent to the browser (302), telling the client application something is potentially amiss). If you are working on a highly secure site and or have non-browser applications accessing the page to pull information, this could be a problem.
Actually you have a third option which might suit your needs. Depending on the way your pages are setup and what you need to do, you can use Server.Transfer also.
If you want to use a button instead of a link just for the way it looks, you can use javascript to change the location of the page in the button's onclick also saving you a trip to the server.