Connecting Tech Pros Worldwide Forums | Help | Site Map

How to control Url access in asp.net

=?Utf-8?B?UGF0cmljay5PIC5JZ2U=?=
Guest
 
Posts: n/a
#1: Jul 14 '08
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

Mark Rae [MVP]
Guest
 
Posts: n/a
#2: Jul 14 '08

re: How to control Url access in asp.net


"Patrick.O .Ige" <PatrickOIge@discussions.microsoft.comwrote in message
news:7EADDAE7-5FBE-4271-B455-164D8872D216@microsoft.com...
Quote:
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);
}
}


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

=?Utf-8?B?UGF0cmljay5PIC5JZ2U=?=
Guest
 
Posts: n/a
#3: Jul 14 '08

re: How to control Url access in asp.net


Thanks Mark.
Taught of that already.Thinking of doing some flagging in the DB


"Mark Rae [MVP]" wrote:
Quote:
"Patrick.O .Ige" <PatrickOIge@discussions.microsoft.comwrote in message
news:7EADDAE7-5FBE-4271-B455-164D8872D216@microsoft.com...
>
Quote:
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);
}
}
>
>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
>
>
Mark Rae [MVP]
Guest
 
Posts: n/a
#4: Jul 14 '08

re: How to control Url access in asp.net


"Patrick.O .Ige" <PatrickOIge@discussions.microsoft.comwrote in message
news:B6C8E811-A337-471E-98D6-967C58AD267D@microsoft.com...

[top-posting corrected]
Quote:
Quote:
Quote:
>>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.
>
Thought of that already.Thinking of doing some flagging in the DB
Like I said, there will be several ways of doing this. However, simplest is
often the best...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Closed Thread