Find Cookie Else Redirect

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Find Cookie Else Redirect

    Hello

    I'm in the finishing stages of a new CMS site and we've recently discovered a tear-out-my-hair authentication problem. Essentially, what I have is a news site. We list articles on the index page requiring registration. What I need to do is this

    When a user clicks on an article headline/url i need to check and see if they have our cookie. If they don't, they need to be redirected to our login page. Now, the login page is legacy ASP, plain and simple. THAT page works if I manually go to it and login (cookie gets set and all).

    The problem is that I cannot get the individual article page (aspx page) to check for cookies and redirect to the ASP page. I've googled this until my fingers bleed and I completely understand forms authentication, but my little red-headed-stepchild procedure will not work. Can anyone help??

    Here's the latest inline code I've tried (feel free to laugh, I'm nearly a neophyte here)

    <script runat="server" language="vb"

    Sub Page_Load(Sender As [Object], e As EventArgs

    Dim myCookieName As HttpCookie = Request.Cookies("yourein"

    'Check to make sure the cookie exist
    If myCookieName Is False The
    Response.Redirect("/mysite/login/login.asp"
    End I
    End Su

    </script

    Thanks so much

    J

    JC Foust Guest

  2. Similar Questions and Discussions

    1. Cookie not set after login and redirect
      Hello I have setup a forms authentication login page and use custom principal and identity. When authenticate everything goes well. But when I set...
    2. Cookie not created with Response.Redirect
      What is the difference between these two methods? The first one does NOT write a Cookie...and the second one does write the cookie. Anyone...
    3. set a cookie and redirect using CGI.pm
      Hello I want to set a user cookie and redirect to a different URL on the same domain. I searched and found alternate ways of doing it. I am...
    4. sending session cookie before redirect
      Hi! I have a function in a lot of pages, which redirects to a new page, if a form has been submitted: if (!(defined("DEBUG_INSERT") &&...
    5. Cookies set one time, I delete cookie, cookie is never set again!
      I am having this problem: My PHP script will set a cookie, it's there in my /Cookies folder. I delete the cookie (I have to for testing purposes,...
  3. #2

    Default RE: Find Cookie Else Redirect

    You may also want to make sure the cookie exists by doing an IsNothing() check on it as well. For more info, check out [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/converttoaspnet.asp[/url]. I had a coworker with the same problem and this seemed to help him out.
    David Coe, MCP Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139