Stupid Forms Auth Question

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

  1. #1

    Default Stupid Forms Auth Question

    I'm new... please be gentle...

    I've built a login form for a very simple website using C#/ASP.NET.
    Security isn't that big of a deal, so I'm storing my passwords in clear
    text in web.config. Here's my web.config:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <system.web>
    <compilation defaultLanguage="c#" debug="true" />
    <authentication mode="Forms">
    <forms name="testcookie" loginUrl="/default.aspx">
    <credentials passwordFormat="Clear">
    <user name="username" password="password"/>
    </credentials>
    </forms>
    </authentication>
    </system.web>
    </configuration>

    And here's the problem - I can bypass the login screen and get to other
    pages that should be protected. For example, when the credentials are
    validated, the user is redirected to members.aspx (in the same
    directory). But right now, I can access members.aspx without ever
    logging in.

    Is the cookie not being created? Is a session not being created? How
    do I set up protected vs. non-protected pages (I don't want it to be
    either/or - I would like some pages open to everyone and others open
    only to a select few)? I'm so anxious to get off the ground, and I was
    wondering if you could spare a minute to help?
    RC Guest

  2. Similar Questions and Discussions

    1. Forms Auth Info passed to Windows Auth?
      The requirement is to build an ASP.Net intranet application, so external users can log in to the main web portal via forms authentication, using...
    2. Forms Auth cookie question
      This may be a dumb question, but does anyone know where the Forms Authentication cookie is kept on an XP box? It definitely isn't kept with all of...
    3. Forms Auth and FormsAuthentication.SignOut()Question
      I'm using Form Auth. I 'm using the FormsAuthentication.SignOut() to sign out But when the user logins in and later logs out using...
    4. Forms Auth with ADirectory Question
      I tried out the code at:- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetse c/html/SecNetHT02.asp But i'm getting the...
    5. Forms Auth Redirect on Access Denied - Question/Help
      If a web app uses forms authentication and a specific aspx page has a role authorization, where should a browser be directed if a user is not in...
  3. #2

    Default Re: Stupid Forms Auth Question

    You seem to have forgotten to put in the "authorization" section of the
    web.config file.

    It should look somewhat like this:
    <authorization>
    <deny users="?" />
    </authorization>

    Take a look at this article for a nice QuickStart:
    [url]http://samples.gotdotnet.com/quickstart/aspplus/doc/formsauth.aspx[/url]

    Sincerely
    Svein Terje Gaup

    "RC" <nainlbb@yahoo.com> wrote in message
    news:110igh6hu3bt6f8@corp.supernews.com...
    > I'm new... please be gentle...
    >
    > I've built a login form for a very simple website using C#/ASP.NET.
    > Security isn't that big of a deal, so I'm storing my passwords in clear
    > text in web.config. Here's my web.config:
    >
    > <?xml version="1.0" encoding="utf-8" ?>
    > <configuration>
    > <system.web>
    > <compilation defaultLanguage="c#" debug="true" />
    > <authentication mode="Forms">
    > <forms name="testcookie" loginUrl="/default.aspx">
    > <credentials passwordFormat="Clear">
    > <user name="username" password="password"/>
    > </credentials>
    > </forms>
    > </authentication>
    > </system.web>
    > </configuration>
    >
    > And here's the problem - I can bypass the login screen and get to other
    > pages that should be protected. For example, when the credentials are
    > validated, the user is redirected to members.aspx (in the same directory).
    > But right now, I can access members.aspx without ever logging in.
    >
    > Is the cookie not being created? Is a session not being created? How do
    > I set up protected vs. non-protected pages (I don't want it to be
    > either/or - I would like some pages open to everyone and others open only
    > to a select few)? I'm so anxious to get off the ground, and I was
    > wondering if you could spare a minute to help?

    Svein Terje Gaup Guest

  4. #3

    Default Re: Stupid Forms Auth Question

    Thanks for the help. That did the trick.

    I guess if I could differentiate protected/non-protected content by
    using a separate folder with a separate web.config file. Feasible? Is
    there a better way?

    I'm fixing to read the link you sent me. Thank you.
    > You seem to have forgotten to put in the "authorization" section of the
    > web.config file.
    >
    > It should look somewhat like this:
    > <authorization>
    > <deny users="?" />
    > </authorization>
    >
    > Take a look at this article for a nice QuickStart:
    > [url]http://samples.gotdotnet.com/quickstart/aspplus/doc/formsauth.aspx[/url]
    RC Guest

  5. #4

    Default Re: Stupid Forms Auth Question

    This is what to do to unprotect one specific page or directory....I inserted
    how to do this inside what you posted earlier. You use the <location> tag.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <system.web>
    <compilation defaultLanguage="c#" debug="true" />
    <authentication mode="Forms">
    <forms name="testcookie" loginUrl="/default.aspx">
    <credentials passwordFormat="Clear">
    <user name="username" password="password"/>
    </credentials>
    </forms>
    </authentication>
    </system.web>

    <location path="Project1/unprotect.aspx">
    <system.web>
    <authorization>
    <allow users="*" />
    </authorization>
    </system.web>
    </location>

    </configuration>


    "RC" <nainlbb@yahoo.com> wrote in message
    news:110iin34jruese4@corp.supernews.com...
    > Thanks for the help. That did the trick.
    >
    > I guess if I could differentiate protected/non-protected content by
    > using a separate folder with a separate web.config file. Feasible? Is
    > there a better way?
    >
    > I'm fixing to read the link you sent me. Thank you.
    >
    > > You seem to have forgotten to put in the "authorization" section of the
    > > web.config file.
    > >
    > > It should look somewhat like this:
    > > <authorization>
    > > <deny users="?" />
    > > </authorization>
    > >
    > > Take a look at this article for a nice QuickStart:
    > > [url]http://samples.gotdotnet.com/quickstart/aspplus/doc/formsauth.aspx[/url]

    Andy G 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