Possible to prevent direct navigation to a page?

G

Guest

Hello
I am in the final stages of developing my asp.net app and have a question.
The app im creating has two frames, one being a menu and the other showing
the detail.

I would like to prevent the user for typing in direct addresses without
using the application (ie server/appname/page.aspx?parameter=value). Is it
possible to prevent a user from attemping this? Can it be detected and then
rerouted to the default page (ie server/appname)?

Thanks in advance.
ben
 
G

Guest

Take a look at the Page.Request.UrlReferrer property which should give you
the address of the previous page. You should probably put this check in a
base class so that all classes inherit it and it is performed automatically.
 
N

Nicholas Paldino [.NET/C# MVP]

Ben,

The only thing that I can think of here is that you have to check the
referrer in the page. If they type it in directly, there will be no
referrer, and then you can block access.

Hope this helps.
 
G

Guest

Thanks for the replies.

I cant seem to get this to work. All the properties of the UrlReferrer seem
to not exist regardless of how I try this. Maybe Ill keep looking.

The only problem i see, is that using the left frame (treeview), when a page
is opened, would there be a value for the urlreferrer? because its like that
page is opened and sent directly to a specific location.

Maybe I need to check during the page load that there is a menu frame open.
hmmm. Is that possible?

Thanks

Nicholas Paldino said:
Ben,

The only thing that I can think of here is that you have to check the
referrer in the page. If they type it in directly, there will be no
referrer, and then you can block access.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ben said:
Hello
I am in the final stages of developing my asp.net app and have a question.
The app im creating has two frames, one being a menu and the other showing
the detail.

I would like to prevent the user for typing in direct addresses without
using the application (ie server/appname/page.aspx?parameter=value). Is
it
possible to prevent a user from attemping this? Can it be detected and
then
rerouted to the default page (ie server/appname)?

Thanks in advance.
ben
 

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

Top