i am sry but the above link doesnt slove my problem
i have a link on my page which points to default5.aspx
but as default5.aspx does not exist on the server the Application_Err or is invoked :
void Application_Err or(object sender, EventArgs e)
{
Server.Transfer ("default.aspx" );
}
which tansfers the user to default.aspx but shows default5.aspx in the address bar.
now if i use state bags like Session["sno"] = "new"; itshows the error that default.aspx is not found on the server.
if use customerrors in web.config then it does redirect to default.aspx but shows some asp error url in the address bar.
but i want to display default5.aspx in the address bar
but how??
When you use Server.Transfer the requested URL is displayed in the browser.
The reason is because the Server changes what ASPX page to display....
For example:
The user requests the requestedAspxPa ge.aspx :
The requestedAspxPa ge.aspx doesn't exist, so you call Server.Transfer (anotherAspxPag e.aspx)
The Server uses anotherAspxPage .aspx instead of the requestedAspxPa ge.aspx.
Since the server handles this, the URL in the web browser is not changed.
Now, if you use Response.Redire ct(anotherAspxP age.aspx), the server returns an HTML code indicating to the browser that it should request anotherAspxPage . The URL is changed and the browser requests the "anotherAspxPag e" instead of the requestedAspxPa ge.
I would use Response.Redire ct for "Page Not Found" (404) errors...becaus e if the url still points to a page that doesn't exist, the next time the user does a postback another error will occur again.
You can Rewrite the URL if you want...
See
URL rewriting in ASP.NET for more information on the topic.
-Frinny