Some simple questions, I assume, on security (Forms authentication)

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

  1. #1

    Default Some simple questions, I assume, on security (Forms authentication)

    Hi. I just began reading on security (Forms authentication). I have the
    following two questions:

    1. Is there a way to specify the expiration date for a cookie set with
    FormsAuthentication.RedirectFromLoginPage ? In "C:\Documents and
    Settings\Administrator\Local Settings\Temporary Internet Files" I see that
    Administrator@localhost is set to expire exactly 50 years from now !

    2. In Web.config I have the following:

    <authentication mode="Forms">
    <forms
    name=".MyCookie"
    loginUrl="Login.aspx"
    protection="All"
    timeout="1"
    path="/"
    />
    </authentication>

    Before I go any further (XML/db saving), I harcoded my users as so:

    If IsValid Then
    If txtUserName.Text.ToLower = "alex" And txtPassword.Text.ToLower =
    "pass" Then
    FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text,
    chkRemember.Checked)
    ElseIf txtUserName.Text.ToLower = "dana" And txtPassword.Text.ToLower =
    "pass" Then
    FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text,
    chkRemember.Checked)
    Else
    lblResults.Text = "Bad username and/or password"
    End If
    End If

    So I do the following test: I run the project from within vsnet, I enter
    Alex/Pass and I select "Remember Me" = True. I look in "C:\Documents and
    Settings\Administrator\Local Settings\Temporary Internet Files" and I see
    Administrator@localhost being created. I open it and I see "MyCookie". Good.

    Now I can go to [url]http://localhost/aspnetprojects/vsnet/FormAuth/Default.aspx[/url],
    my "main" page.

    Next, I open a separate instance of IE (planning to login as "dana"), I
    type in [url]http://localhost/aspnetprojects/vsnet/FormAuth/Default.aspx[/url] - I
    expected NOT to see it, but to be redirected to Login instead. However, I go
    directly to Default.aspx - as if if a single user is logged in correctly,
    everybody else can go and see the "Default" page.

    Now if the "first user" (the one which created the cookie, Alex) logs out
    (FormsAuthentication.SignOut), then the cookie is deleted. If at this point
    in IE (where for some obscure reason the second user, "Dana", was already IN
    "Default.aspx") I hit F5, "Dana" is sent to the LOGIN page - now that's
    correct - it was to be expected.

    So... I am really confused. Why does this happen ? What am I missing here ?

    Thanks a lot for spending time reading my post.
    Alex.


    Alex Nitulescu Guest

  2. Similar Questions and Discussions

    1. A couple of simple forms questions.
      Forgive me, it's been awhile since I've worked with this stuff... I'm creating a simple form to use for order entry. I'll need to include...
    2. Applying security at folder level using forms authentication
      Hi I have two folders in the .net application,one can be accessed by everyone adn the other needs to be accessed only through submitting login and...
    3. Forms Security Authentication.
      Hi I have done all the plumbing for a Forms Authentication system. My user logs in, I chek password with ADO.NET to a database with 2 fields. ...
    4. ASP.Net Forms authentication with basic authentication popup
      Relatively new to ASP.Net but have a strange problem. My site uses forms authentication for a large administration section however after the user...
    5. Authentication ticket, cookieless, forms authentication?
      Hi. I want to use Forms Authentication, cookieless. The issue is setting the Authentication Ticket without using cookies (!) That is, the...
  3. #2

    Default Re: Some simple questions, I assume, on security (Forms authentication)

    Me again !

    Sorry, I must have been sleeping - the second question was indeed stupid. Of
    course it happens this way !

    Mea Culpa, Alex.


    Alex Nitulescu 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