Results 1 to 5 of 5

Thread: URL Redirect when not logged in

  1. #1

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    URL Redirect when not logged in

    Allright, pretty much every page of mine has a function that checks if the user is logged in. It also checks if the user has the required access.

    Now, what is the best way to return the user to a page if they get redirected to the unauthorized.asp page?

    For example:
    John wants to access admin.asp but is not logged in and is redirected to unauthroized.asp

    Should I just be passing in the URL through a Query String? Or is this not a good way to do it.
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Hi Alek,
    I tend to use Cookies or session to store the last page and redirect them if they are successfuly authenticated...
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    It's a very common way, no harm in doing it. Since each page checks for the authorization level, there's no harm in passing the URL to go to in the URL itself.

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by mendhak
    It's a very common way, no harm in doing it. Since each page checks for the authorization level, there's no harm in passing the URL to go to in the URL itself.
    Yep, but sometime time if you need to pass over to 2/3 pages becore redirecting, it is better i think to use cookies/session instead of carrying over those pages. Personal preference i guess .
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Can't you just have an 'unauthorised.asp' file which is located in the same place for all, or duplicated in each folder, then if they aren't logged in, it just redirects to that file, before sending anything into the browser.


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

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