Problem in pafe navigation using hyperlink

Posted by Rickeybglr under ASP.NET on 12/21/2012 | Points: 10 | Views : 919 | Status : [Member] | Replies : 2
Hi,

i have a 2 hyperlink on a page. the 1st hyperlink refers to previous page and the 2nd hyperlink refer tp current page itself
it works fine, when click on 1st hyperlink it redirect to previous page. but it fails when i click on the 2nd hyperlink then again on 1st hyperlink it would not get redirected.
below is my code:
if (Session["ssn1stPage"] != null)
{
string url = Request.Url.AbsoluteUri;
string urlPrevPage = Page.Request.UrlReferrer.AbsoluteUri;
Session["ssn2ndPage"] = "2ndPage".ToString();

hypLnk1.Text = Session["ssn1stPage"].ToString();
hypLnk2.Text = Session["ssn2ndPage"].ToString();

hypLnk1.NavigateUrl = urlPrevPage;
hypLnk2.NavigateUrl = url;
}
else
{
Response.Redirect("1stPage.aspx",true);
}
problem is tht when i click on the 2nd hyperlnk, the value of string urlPrevPage changes to the current one.
Please suggest ...




Responses

Posted by: Shipramaurya on: 12/26/2012 [Member] Starter | Points: 25

Up
0
Down
I wanted to ask where You have written this code... Was it on Page_Load event ???

@Shipra - S.M. Techie

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/26/2012 [Member] Bronze | Points: 25

Up
0
Down
Check session values on every click, you might be over writing them some where

Thanks
Pavan Kumar
Mark Answer if this fits the need

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response