To ensure that users come from page1 before going to page2
-
Hi guys, I'm wondering if it there is a better way of doing this, I have 2 webpages, page1 and page2. I want to ensure that users would go to page1 before going to page2 (a button on page1, redirects it to page2), so that if the user types in the URL of page2, it will redirect to page1 first. I am currently using the
Request.UrlReferrer.ToString()
to get the the previous webpage and comparing it. If it is from page1 then page2 will open if not it will redirect to page1 (the code is below). I'm just wondering if there is a better way of doing this? Thanks.protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.UrlReferrer.ToString() != "page1")
{
Response.Redirect("page1");
}
}
} -
Hi guys, I'm wondering if it there is a better way of doing this, I have 2 webpages, page1 and page2. I want to ensure that users would go to page1 before going to page2 (a button on page1, redirects it to page2), so that if the user types in the URL of page2, it will redirect to page1 first. I am currently using the
Request.UrlReferrer.ToString()
to get the the previous webpage and comparing it. If it is from page1 then page2 will open if not it will redirect to page1 (the code is below). I'm just wondering if there is a better way of doing this? Thanks.protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.UrlReferrer.ToString() != "page1")
{
Response.Redirect("page1");
}
}
}I would put pages one and two on the same URL, as controls. Then I'd use viewstate to store if the user had viewed page one before allowing page 2 to show, and set something on the URL to show page 2.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I would put pages one and two on the same URL, as controls. Then I'd use viewstate to store if the user had viewed page one before allowing page 2 to show, and set something on the URL to show page 2.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Can that be easily done? I have a lot of controls in page1 and page2.
-
I would put pages one and two on the same URL, as controls. Then I'd use viewstate to store if the user had viewed page one before allowing page 2 to show, and set something on the URL to show page 2.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
I would put pages one and two on the same URL, as controls
I think wizard control has similar property ...
Apurv “Never trust a computer you can’t throw out a window.” (Steve Wozniak) “There are only two industries that refer to their customers as ‘users’.” (Edward Tufte)
-
Christian Graus wrote:
I would put pages one and two on the same URL, as controls
I think wizard control has similar property ...
Apurv “Never trust a computer you can’t throw out a window.” (Steve Wozniak) “There are only two industries that refer to their customers as ‘users’.” (Edward Tufte)
Yes, but the more you use the ridiculous built in stuff, the less control you have over what's going on.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Can that be easily done? I have a lot of controls in page1 and page2.
Yes, just move all the code from your aspx and aspx.cs to ascx and ascx.cs files. Then put those two controls on the one page.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Yes, but the more you use the ridiculous built in stuff, the less control you have over what's going on.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.