Determine path of page **Resolved**
hi all,
I have several pages in an asp.net application that requires a user to login through a login.aspx webform before being able to access the resources in the application. now my problem is that in each and every aspx page, I need to check if the user has already logged into the system, failing which i need to redirect him to the login.aspx webform. to do so i have implemented a function in a module to check the login status and perform the page redirection. the problem is that the login page is not always the same relative path in respect to the other pages of the application, since most of the pages are found in different sub-folders. So what i need is to be able to obtain the path of the current page that is being run. something like the path of the page relative to the root folder etc. is this at all possible?
thanx all
Re: Determine path of page
Yes, I believe you're looking for
VB Code:
Request.ServerVariables("Script_Name")
Here is a full list of the server variables 4guysfromrolla
Cheers Al
Re: Determine path of page
Well in fact what i needed was HttpContext.Current.Request.Path.ToString, that gives you the current path of the page that was requested in fact. thanx anyways :)
Re: Determine path of page **Resolved**
VBud,
I've just tested your response and they return exactly the same thing. Anyway glad you're sorted
HttpContext.Current.Request.Path.ToString
HttpContext.Current.Request.ServerVariables("Script_Name")