473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to prohibit bypassing a required page?

Let me try to make clear what my concern is. I think it is a pretty
interesting one, which I think of while I am developing my web
application.

I have an authenticated/authorized web application. People have to
login from http://mydomain.com/ to access the information on my site.

For now, this is working fine. People cannot bypass the login form,
any attempt to check out a page (if they happen to know the file name)
will be redirected to the login page.

Now, after a user successfully logs in, he needs to complete some forms
in a sequence of a few pages. Suppose that form1.aspx is required, the
RequiredField validation check on this page prohibits a user from
proceeding if the required fileds are not filled.

However, a smart user can bypass this page if s/he simply changes the
URL in the address bar, say, from http://mydomain.com/form1.aspx to
http://mydomain.com/form2.aspx. Let's assume that they happen to know
some of the file names over there.

So, here is my question: How to prevent them from bypassing the
required page? I know that I can probably use weird, hard-to-guess or
hard-to-remember file names like
"weoi23lad345aas945kdfa-sldfkj-sdlfas0jdfla2e2er8237pq52e0i9.aspx", but
this is silly and isn't really safe.

Thanks.

Mar 11 '06 #1
4 1879
The best way is IIdentity and IPrincipal, but that may be overkill.
Create on object.

class RegisterPagesCheck
bool Page1Verfied
bool Page2Verified
bool Page3 Verified
When the user sucessfully fills in page1 correctly, then

RegisterPagesCheck newUser = new RegisterPagesCheck ();
newUser.Page1Verified = true;

now put newUser in the SESSION variable.
Session["mykeyname"] = newUser;

...

on page2 load... pull the cached version.

if (null!=Session["mykeyname"])
{
RegisterPagesCheck checkFromSession =
(RegisterPagesCheck )Session["mykeyname"];
}
if (null!= checkFromSession)
{
if (checkFromSession.Form1Verified == false
{
Response.Redirect("./login.aspx");
}
}
somehting like that.

when you get to the Page2 verifiy, you'll still have to get the session
cached object.. and then update
..Page2Verified = true

on page 3, pull the object from session, and check for trues on Page1Verify
and Page2Verify.
...

Check my blog
http://spaces.msn.com/sholliday/ 10/24/2005
for a fancier session object.


<an***********@yahoo.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Let me try to make clear what my concern is. I think it is a pretty
interesting one, which I think of while I am developing my web
application.

I have an authenticated/authorized web application. People have to
login from http://mydomain.com/ to access the information on my site.

For now, this is working fine. People cannot bypass the login form,
any attempt to check out a page (if they happen to know the file name)
will be redirected to the login page.

Now, after a user successfully logs in, he needs to complete some forms
in a sequence of a few pages. Suppose that form1.aspx is required, the
RequiredField validation check on this page prohibits a user from
proceeding if the required fileds are not filled.

However, a smart user can bypass this page if s/he simply changes the
URL in the address bar, say, from http://mydomain.com/form1.aspx to
http://mydomain.com/form2.aspx. Let's assume that they happen to know
some of the file names over there.

So, here is my question: How to prevent them from bypassing the
required page? I know that I can probably use weird, hard-to-guess or
hard-to-remember file names like
"weoi23lad345aas945kdfa-sldfkj-sdlfas0jdfla2e2er8237pq52e0i9.aspx", but
this is silly and isn't really safe.

Thanks.

Mar 11 '06 #2
Hi, Sloan,

Thanks. IIdentity and IPrincipal are very new to me. I have only a
very small web application with only 4 to 5 pages.

I think an easier solution would be to create the page on-the-fly that
follows the required form1.aspx. This way, a user has nothing to check
out if he does not go through form1.aspx.

You think this would be doable?
sloan wrote:
The best way is IIdentity and IPrincipal, but that may be overkill.
Create on object.

class RegisterPagesCheck
bool Page1Verfied
bool Page2Verified
bool Page3 Verified
When the user sucessfully fills in page1 correctly, then

RegisterPagesCheck newUser = new RegisterPagesCheck ();
newUser.Page1Verified = true;

now put newUser in the SESSION variable.
Session["mykeyname"] = newUser;

..

on page2 load... pull the cached version.

if (null!=Session["mykeyname"])
{
RegisterPagesCheck checkFromSession =
(RegisterPagesCheck )Session["mykeyname"];
}
if (null!= checkFromSession)
{
if (checkFromSession.Form1Verified == false
{
Response.Redirect("./login.aspx");
}
}
somehting like that.

when you get to the Page2 verifiy, you'll still have to get the session
cached object.. and then update
.Page2Verified = true

on page 3, pull the object from session, and check for trues on Page1Verify
and Page2Verify.
..

Check my blog
http://spaces.msn.com/sholliday/ 10/24/2005
for a fancier session object.


<an***********@yahoo.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Let me try to make clear what my concern is. I think it is a pretty
interesting one, which I think of while I am developing my web
application.

I have an authenticated/authorized web application. People have to
login from http://mydomain.com/ to access the information on my site.

For now, this is working fine. People cannot bypass the login form,
any attempt to check out a page (if they happen to know the file name)
will be redirected to the login page.

Now, after a user successfully logs in, he needs to complete some forms
in a sequence of a few pages. Suppose that form1.aspx is required, the
RequiredField validation check on this page prohibits a user from
proceeding if the required fileds are not filled.

However, a smart user can bypass this page if s/he simply changes the
URL in the address bar, say, from http://mydomain.com/form1.aspx to
http://mydomain.com/form2.aspx. Let's assume that they happen to know
some of the file names over there.

So, here is my question: How to prevent them from bypassing the
required page? I know that I can probably use weird, hard-to-guess or
hard-to-remember file names like
"weoi23lad345aas945kdfa-sldfkj-sdlfas0jdfla2e2er8237pq52e0i9.aspx", but
this is silly and isn't really safe.

Thanks.


Mar 11 '06 #3
On 11 Mar 2006 10:04:35 -0800, an***********@yahoo.com wrote:
So, here is my question: How to prevent them from bypassing the
required page? I know that I can probably use weird, hard-to-guess or
hard-to-remember file names like
"weoi23lad345aas945kdfa-sldfkj-sdlfas0jdfla2e2er8237pq52e0i9.aspx", but
this is silly and isn't really safe.


Lots of solutions to this problem.

1) if you're using ASP.NET 2.0 you can use the new "Wizard" control that
will provide a sequenced page set of functionality. They can't jump into
the middle of it because it's all happening on one page, fed by postback
values.

2) You can pass postback values yourself to each page. This is relatively
easy to do using ASP.NET 2.0, and a bit more difficult to do with 1.x but
can be done. Then, in each successive page, you test for the presence of a
particular value in the posted data.

3) You can use session variables to indicate the successful completion of a
given page. Then in the next page you check to see if all the requirements
have been met to view that page, otherwise redirect back to the page they
need to coplete. Though this won't work if they close the browser
mid-session and come back to it later.

4) You can store workflow information in a database. For example, maybe
you want to make sure they've agreed to the terms of service before you let
them use the site. You can store the terms of service acknowledgement in
the database.

5) You can generate unique sequence id's and pass them on the URL. When
the user finishes a page, you add a sequence ID to a table and associate it
with a certain page. When that sequence id is requested, you retrieve that
page via a User Control or Server Side Include.

There are really a lot of potential ways to handle this, how you do it is
up to you.
Mar 11 '06 #4
The options you offer are really great, although probably only option 3
sounds easier for me to handle (I am very new to the .Net platform) for
my small web application.

I guess I am gonna use option 3. Then when the "Continue" button on
form1.aspx is clicked, I create a session object "form1_done" and let
it equal "true".

Then in Sub Page_Load of form2.aspx, I check this session object, and
if it is there and has the value "true", I do nothing, otherwise, I
Response.Redirect("form1.aspx").

Will this work? Or is there a better solution? I don't have access to
my web server at this moment, so I cannot test it.

Erik Funkenbusch wrote:
On 11 Mar 2006 10:04:35 -0800, an***********@yahoo.com wrote:
So, here is my question: How to prevent them from bypassing the
required page? I know that I can probably use weird, hard-to-guess or
hard-to-remember file names like
"weoi23lad345aas945kdfa-sldfkj-sdlfas0jdfla2e2er8237pq52e0i9.aspx", but
this is silly and isn't really safe.


Lots of solutions to this problem.

1) if you're using ASP.NET 2.0 you can use the new "Wizard" control that
will provide a sequenced page set of functionality. They can't jump into
the middle of it because it's all happening on one page, fed by postback
values.

2) You can pass postback values yourself to each page. This is relatively
easy to do using ASP.NET 2.0, and a bit more difficult to do with 1.x but
can be done. Then, in each successive page, you test for the presence of a
particular value in the posted data.

3) You can use session variables to indicate the successful completion of a
given page. Then in the next page you check to see if all the requirements
have been met to view that page, otherwise redirect back to the page they
need to coplete. Though this won't work if they close the browser
mid-session and come back to it later.

4) You can store workflow information in a database. For example, maybe
you want to make sure they've agreed to the terms of service before you let
them use the site. You can store the terms of service acknowledgement in
the database.

5) You can generate unique sequence id's and pass them on the URL. When
the user finishes a page, you add a sequence ID to a table and associate it
with a certain page. When that sequence id is requested, you retrieve that
page via a User Control or Server Side Include.

There are really a lot of potential ways to handle this, how you do it is
up to you.


Mar 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MB | last post by:
Hi, I am doing a project which uses asp.net to develop its forms. The form uses validation web controls to validate the data entered in text boxes. When Cancel Button is pressed which is to exit...
1
by: tim almond | last post by:
I currently have a system where the client has a login page which has a SQL server database behind it and does authentication. The client wants to have a page which can be logged into by passing...
0
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
4
by: Boni | last post by:
Dear all, can I prohibit that my class will be passed by value (i.e created a copy on stack when function is called)? I want to prohibit passing my class by value. I thougth that declare a default...
5
by: John | last post by:
Hi I have established form authentication so every page on the site send the access to a specific login page. I need however to bypass the authentication for my web service page to allow it to...
6
by: John | last post by:
Hi I need to block user from moving away from a record using any of First/Last/Prev/Next/New Record or any other way IF the record has not been saved, and displaying a message to the effect...
9
by: bonk | last post by:
Does anyone have a simple example on how to prohibit that any thread other than the current thread modifies a certain object (a collection) while we are in a certain section of the code? In other...
1
by: =?Utf-8?B?QXVzdGluIFN0ZXBoZW5z?= | last post by:
In my commercial financial application I run a deposit report. I use an option to copy the report to the Clipboard. I then run a .NET consol app to “grab” the Clipboard and format the data...
10
by: Tim Streater | last post by:
I have a form and a button to submit it. The button is made from: <input type=button onclick='myHandler(this.form);'> This all works fine except that in Safari 2.0.4, the enter/return keys, if...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.