How to control Url access in asp.net

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
 
P

Patrick.O .Ige

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);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top