How to control Url access in asp.net

  • Thread starter Thread starter Patrick.O .Ige
  • Start date Start date
P

Patrick.O .Ige

Hi guys,
I want users to complete a webform or edit a page before getting to
a specific page.
The pages need to do the following:
1)Check to see if they need to edit or complete a form if YES then until
they complete it they can get to a specific page or URL. If not i sent them
to the page they need to get to
2)But the thing is if a user is smart they can copy the url and paste it
directly.
And if they do that i want to throw them out .
How can i let a user get to the url unless they have done what i wanted.
Thanks in advance
 
Thanks Mark.
Taught of that already.Thinking of doing some flagging in the DB


Mark Rae said:
I want users to complete a webform or edit a page before getting to
a specific page.
The pages need to do the following:
1)Check to see if they need to edit or complete a form if YES then until
they complete it they can get to a specific page or URL. If not i sent
them
to the page they need to get to
2)But the thing is if a user is smart they can copy the url and paste it
directly.
And if they do that i want to throw them out .
How can i let a user get to the url unless they have done what i wanted.

Several ways, probably...

However, an extremely simple way would be to use a Session variable.

When a user first accesses the site (or logs in...) set a Session variable
e.g.

Session["CanProceed"] = false;

Then, once the user has done what you want, set the Session variable to
true;

On any page which they shouldn't access unless they have done what you want,
simply check the value of the Session variable, e.g.

protected Page_Init (object sender, EventArgs e)
{
if (!(bool)Session["CanProceed"])
{
Response.Redirect(MyOtherPage.aspx, false);
}
}
 
Back
Top