Possible to prevent direct navigation to a page?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
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.
 
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
 
Back
Top