Deny access to a particular page

Results 1 to 4 of 4

Thread: Deny access to a particular page

  1. #1
    David Samuel Guest

    Default Deny access to a particular page

    Hi,<BR>I am learning ASP and I have this question. <BR><BR>I am setting my cookies with Response.cookies("mycookie") and accessing the cookies through request.cookie("mycookie"). I have login page called login.asp where the cookie is set. I am checking the login ID and password in a page called result.asp.<BR><BR>If the user is validated, a main.asp page is displayed and the main.asp page is displayed in the URL like,<BR><BR>I like to deny the access if the user directly types and display a suitable message on the browser and direct the user to the login.asp page.<BR><BR>Request for a solution.

  2. #2
    Daniel Guest

    Default RE: Deny access to a particular page

    add this in the top of main.asp<BR><BR>if request.cookies("mycookie") = "" then<BR>response.redirect ("login.asp")<BR>end if<BR><BR>Use session varible is better.<BR>

  3. #3
    Jonathan Swartz Guest

    Default RE: Deny access to a particular page

    Simple, just put a check at the beginning of the page like...<BR><BR>If Request.Cookies("mycookie") = "" Then<BR> Response.Redirect "login.asp"<BR>End If<BR><BR>I usually append some querystring arguments to tell me what happened, like...<BR><BR>Response.Redirect "login.asp?err=1&errnum=1"<BR><BR>and then I know that an error number of 1 is bad password or something like that. I usually don&#039t pass a message back because I think it&#039s cheesy, just my opinion. Hope that helps.<BR><BR>Good luck,<BR>Jonathan<BR>

  4. #4
    Join Date
    Dec 1969

    Default RE: Deny access to a particular page

    Use <BR>response.redirect("url") <BR>right at the top of the page from where you want the user to be resirected to the login.asp page.

Posting Permissions

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