vicomin
asked on
get referring page name
i need to just get the referring page name only and nothing else. then set the focus on a page control.
if (!Page.IsPostBack)
{
string MyReferrer = Request.ServerVariables["HTTP_REFERER"];
if (MyReferrer == "udata.aspx" )
{
txtbxSearchSerialNumber.Focus();
}
//Response.Write(MyReferrer); //http://localhost:3627/FTs/udata.aspx?fti=4
}
ASKER
yeah got that - just need to figure out how to get the file name only
You may extract it to get the last segment for the page name, for example:
string refPageName = Request.UrlReferrer.Segmen ts[Request .UrlReferr er.Segment s.Length - 1];
string refPageName = Request.UrlReferrer.Segmen
ASKER
Request.UrlReferrer.Segmen ts[Request .UrlReferr er.Segment s.Length - 1];
errors with:
Object reference not set to an instance of an object.
errors with:
Object reference not set to an instance of an object.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
here is the code for the referrer only :)
Open in new window