Results 1 to 4 of 4

Thread: Determine path of page **Resolved**

  1. #1

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378

    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
    Last edited by vbud; Oct 12th, 2005 at 12:56 AM. Reason: Resolved
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  2. #2
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: Determine path of page

    Yes, I believe you're looking for

    VB Code:
    1. Request.ServerVariables("Script_Name")

    Here is a full list of the server variables 4guysfromrolla

    Cheers Al

  3. #3

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378

    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
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  4. #4
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    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")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width