Click here to Skip to main content
16,020,669 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
to get previous page url i have used this code....

C#
string referrerurl = request.urlreferrer.tostring();


but not working in IE6....


can anyone help me.............


Thanks
Posted
Updated 20-Mar-12 22:20pm
v2
Comments
ZurdoDev 21-Mar-12 8:01am    
A quick google search indicates lots of people have had this issue. Have you checked google?
vivekx2 21-Mar-12 8:36am    
yes...but there is no solution .....

1 solution

Hi,
C#
String referer = Request.UrlReferrer.ToString();


One thing to remember is that UrlReferrer will change to your pagename when you post back to the server.. so you should maybe store the value in ViewState on the first page load of the page if you are wanting to redirect the user to the previous page after a couple postbacks to the same page.
C#
if( !IsPostBack )
{
 ViewState["PreviousPageUrl"] = Request.UrlReferrer.ToString();
}


The situations where it does work include the following methods of a browser loading a URL:

clicking on a straight HTML <a href> link;
submitting a form, using POST or GET, from a submit button, <input type=image> or client-side script (form.submit())

The situations where it doesn't work:

using Response.Redirect / Server.Transfer;
clicking on a Favorite, History, or the recently-typed URLs list;
clicking on 'Home' in IE's toolbar, or an item in IE's 'Links' toolbar;
using location.href or location.replace() in client-side JScript/JavaScript/VBScript;
using HierMenus (details);
typing the URL directly in the browser and hitting Enter or clicking 'Go';
launching a clickable URL from an e-mail or MS Office document;
using Response.AddHeader or <meta http-equiv=refresh> to redirect;
loading the URL with XML
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900