forms authentication problem

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

  1. #1

    Default Forms Authentication Problem

    I tried on the Security newgroup, as well as other places, and haven't
    gotten an answer yet - - I'm pulling my hair out over this one.

    I'm trying to get Forms Authentication working.....I can get any requested
    page to automatically go to the Login.aspx page, AND, the ReturnURL
    querystring is correct in the address bar, but no matter what, I can't get
    it, once the user is authenticated, to redirect to the new page. It ALWAYS
    refreshes the Login.aspx page!

    My database has all the users - - I query the database and validate the user
    there. This part works - - I've totally verified this.
    Then - - I've got this:
    if ValidUser="True" then
    FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    <-------this is the part that DOES NOT work at all - - it never redirects
    the page

    The machine.config points to the correct path for the WebUIValidation.js
    file....I'm using MSIE, as are all the other users who are going to be
    hitting this app. - - Scripting is allowed.

    in the Web.Config, I've got:
    <authentication mode="Forms">
    <forms name=".MyApp"
    loginUrl="login.aspx"
    protection="All"
    timeout="480"
    path="/"
    />
    </authentication>
    <authorization>
    <deny users ="?" />
    </authorization>
    And I'm importing the Web.Security Namespace on each page.
    Does Each subsequent page need anything else in it to make this work?
    Please help - - I've been working on this for over a week now! What am I
    missing?


    ElmoWatson Guest

  2. Similar Questions and Discussions

    1. Problem in forms authentication
      Hi friends, We have an web application which contains several folders & we are trying to implement forms authentication. Login page for the...
    2. Forms Authentication problem with IsAuthenticated
      Hello All, I am trying to set up forms authentication for an ASP.NET web site. I programmed quite a bit of stuff with custom IPrincipal and...
    3. Forms Authentication Problem with WebRequest (Tried Everything)
      Hello, all, I have done my homework, but I can not get my webrequest to access a page which is protected by forms authentication. As other...
    4. Problem with Forms Authentication
      I have an application using FormsAuthentication that does not persist the authentication cookie beyond the session so each time a user starts a...
    5. ssl with <forms authentication> and loginurl problem
      Hi, I've configured SSL with server certificates on a IIS with W2K. Itested it ans works with simple html pages. I want the login page to be under...
  3. #2

    Default Re: Forms Authentication Problem

    are you sure ValidUser is returning "true" ?



    "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > I tried on the Security newgroup, as well as other places, and haven't
    > gotten an answer yet - - I'm pulling my hair out over this one.
    >
    > I'm trying to get Forms Authentication working.....I can get any requested
    > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > querystring is correct in the address bar, but no matter what, I can't get
    > it, once the user is authenticated, to redirect to the new page. It ALWAYS
    > refreshes the Login.aspx page!
    >
    > My database has all the users - - I query the database and validate the
    user
    > there. This part works - - I've totally verified this.
    > Then - - I've got this:
    > if ValidUser="True" then
    > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > <-------this is the part that DOES NOT work at all - - it never redirects
    > the page
    >
    > The machine.config points to the correct path for the WebUIValidation.js
    > file....I'm using MSIE, as are all the other users who are going to be
    > hitting this app. - - Scripting is allowed.
    >
    > in the Web.Config, I've got:
    > <authentication mode="Forms">
    > <forms name=".MyApp"
    > loginUrl="login.aspx"
    > protection="All"
    > timeout="480"
    > path="/"
    > />
    > </authentication>
    > <authorization>
    > <deny users ="?" />
    > </authorization>
    > And I'm importing the Web.Security Namespace on each page.
    > Does Each subsequent page need anything else in it to make this work?
    > Please help - - I've been working on this for over a week now! What am I
    > missing?
    >
    >

    Seaside Guest

  4. #3

    Default Re: Forms Authentication Problem

    Yes - I'm sure - absolutely positive



    "Seaside" <ss@hotmail.com> wrote in message
    news:ez0MMe2WDHA.3444@tk2msftngp13.phx.gbl...
    > are you sure ValidUser is returning "true" ?
    >
    >
    >
    > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > I tried on the Security newgroup, as well as other places, and haven't
    > > gotten an answer yet - - I'm pulling my hair out over this one.
    > >
    > > I'm trying to get Forms Authentication working.....I can get any
    requested
    > > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > > querystring is correct in the address bar, but no matter what, I can't
    get
    > > it, once the user is authenticated, to redirect to the new page. It
    ALWAYS
    > > refreshes the Login.aspx page!
    > >
    > > My database has all the users - - I query the database and validate the
    > user
    > > there. This part works - - I've totally verified this.
    > > Then - - I've got this:
    > > if ValidUser="True" then
    > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > > <-------this is the part that DOES NOT work at all - - it never
    redirects
    > > the page
    > >
    > > The machine.config points to the correct path for the WebUIValidation.js
    > > file....I'm using MSIE, as are all the other users who are going to be
    > > hitting this app. - - Scripting is allowed.
    > >
    > > in the Web.Config, I've got:
    > > <authentication mode="Forms">
    > > <forms name=".MyApp"
    > > loginUrl="login.aspx"
    > > protection="All"
    > > timeout="480"
    > > path="/"
    > > />
    > > </authentication>
    > > <authorization>
    > > <deny users ="?" />
    > > </authorization>
    > > And I'm importing the Web.Security Namespace on each page.
    > > Does Each subsequent page need anything else in it to make this work?
    > > Please help - - I've been working on this for over a week now! What am I
    > > missing?
    > >
    > >
    >
    >

    ElmoWatson Guest

  5. #4

    Default Re: Forms Authentication Problem

    Thanks - I checked it out - - all the code listings links don't go to the
    code at all....nice article, but it doesn't tell me where my problem is.
    BTW - If I remove the deny users part - - - - it bypasses the login.aspx
    file altogether. I at least had that working


    "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    news:%23razhf2WDHA.608@TK2MSFTNGP12.phx.gbl...
    > Elmo,
    >
    > When you use a database with forms authentication you need to remove the
    > deny users attribute in the web.config file. You then have to create a
    > method that does the validation for you.
    >
    > Here's a good article about using a database with form authentication:
    >
    [url]http://www.zdnet.com.au/builder/program/windows/story/0,2000035027,20274191,00.htm[/url]
    >
    > Sincerely,
    >
    > --
    > S. Justin Gengo, MCP
    > Web Developer
    >
    > Free code library at:
    > [url]www.aboutfortunate.com[/url]
    >
    > "Out of chaos comes order."
    > Nietzche
    > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > I tried on the Security newgroup, as well as other places, and haven't
    > > gotten an answer yet - - I'm pulling my hair out over this one.
    > >
    > > I'm trying to get Forms Authentication working.....I can get any
    requested
    > > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > > querystring is correct in the address bar, but no matter what, I can't
    get
    > > it, once the user is authenticated, to redirect to the new page. It
    ALWAYS
    > > refreshes the Login.aspx page!
    > >
    > > My database has all the users - - I query the database and validate the
    > user
    > > there. This part works - - I've totally verified this.
    > > Then - - I've got this:
    > > if ValidUser="True" then
    > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > > <-------this is the part that DOES NOT work at all - - it never
    redirects
    > > the page
    > >
    > > The machine.config points to the correct path for the WebUIValidation.js
    > > file....I'm using MSIE, as are all the other users who are going to be
    > > hitting this app. - - Scripting is allowed.
    > >
    > > in the Web.Config, I've got:
    > > <authentication mode="Forms">
    > > <forms name=".MyApp"
    > > loginUrl="login.aspx"
    > > protection="All"
    > > timeout="480"
    > > path="/"
    > > />
    > > </authentication>
    > > <authorization>
    > > <deny users ="?" />
    > > </authorization>
    > > And I'm importing the Web.Security Namespace on each page.
    > > Does Each subsequent page need anything else in it to make this work?
    > > Please help - - I've been working on this for over a week now! What am I
    > > missing?
    > >
    > >
    >
    >

    ElmoWatson Guest

  6. #5

    Default Re: Forms Authentication Problem

    see S.Justin Gengo's reply



    "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    news:OikY$72WDHA.2424@TK2MSFTNGP12.phx.gbl...
    > Yes - I'm sure - absolutely positive
    >
    >
    >
    > "Seaside" <ss@hotmail.com> wrote in message
    > news:ez0MMe2WDHA.3444@tk2msftngp13.phx.gbl...
    > > are you sure ValidUser is returning "true" ?
    > >
    > >
    > >
    > > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > > I tried on the Security newgroup, as well as other places, and haven't
    > > > gotten an answer yet - - I'm pulling my hair out over this one.
    > > >
    > > > I'm trying to get Forms Authentication working.....I can get any
    > requested
    > > > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > > > querystring is correct in the address bar, but no matter what, I can't
    > get
    > > > it, once the user is authenticated, to redirect to the new page. It
    > ALWAYS
    > > > refreshes the Login.aspx page!
    > > >
    > > > My database has all the users - - I query the database and validate
    the
    > > user
    > > > there. This part works - - I've totally verified this.
    > > > Then - - I've got this:
    > > > if ValidUser="True" then
    > > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > > > <-------this is the part that DOES NOT work at all - - it never
    > redirects
    > > > the page
    > > >
    > > > The machine.config points to the correct path for the
    WebUIValidation.js
    > > > file....I'm using MSIE, as are all the other users who are going to be
    > > > hitting this app. - - Scripting is allowed.
    > > >
    > > > in the Web.Config, I've got:
    > > > <authentication mode="Forms">
    > > > <forms name=".MyApp"
    > > > loginUrl="login.aspx"
    > > > protection="All"
    > > > timeout="480"
    > > > path="/"
    > > > />
    > > > </authentication>
    > > > <authorization>
    > > > <deny users ="?" />
    > > > </authorization>
    > > > And I'm importing the Web.Security Namespace on each page.
    > > > Does Each subsequent page need anything else in it to make this work?
    > > > Please help - - I've been working on this for over a week now! What am
    I
    > > > missing?
    > > >
    > > >
    > >
    > >
    >
    >

    Seaside Guest

  7. #6

    Default Re: Forms Authentication Problem

    Elmo,

    It may be redirecting to the page, then redirecting right back to the login
    page when it's found that the user isn't authenticated.

    The question will be "why isn't the user authenticated when I think he
    should be?" Answers I've seen include:

    1) Because the cookie is set up wrong and Forms Authentication never sees
    it. Check on the domain, path and expiration of the cookie. In particular,
    make sure the cookie domain matches your domain. localhost has a blank
    domain, BTW.
    2) Because the login page and the page you're redirecting to have different
    values in the <machineKey> entry in machine.config or web.config.
    3) The user _is_ authenticated, but not authorized. Maybe URL authorization
    has a typo in a role name, or roles aren't being applied in global.asax.

    It sounds like it's time for you to look one layer deeper. In particular,
    try turning on tracing in web.config:

    <trace enabled="true" requestLimit="100" pageOutput="false"
    traceMode="SortByTime" localOnly="true" />

    Then reproduce the problem and navigate to
    [url]http://localhost/yourSite/trace.axd[/url]. It may be instructive.
    --
    John Saunders
    Internet Engineer
    [email]john.saunders@surfcontrol.com[/email]



    "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > I tried on the Security newgroup, as well as other places, and haven't
    > gotten an answer yet - - I'm pulling my hair out over this one.
    >
    > I'm trying to get Forms Authentication working.....I can get any requested
    > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > querystring is correct in the address bar, but no matter what, I can't get
    > it, once the user is authenticated, to redirect to the new page. It ALWAYS
    > refreshes the Login.aspx page!
    >
    > My database has all the users - - I query the database and validate the
    user
    > there. This part works - - I've totally verified this.
    > Then - - I've got this:
    > if ValidUser="True" then
    > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > <-------this is the part that DOES NOT work at all - - it never redirects
    > the page
    >
    > The machine.config points to the correct path for the WebUIValidation.js
    > file....I'm using MSIE, as are all the other users who are going to be
    > hitting this app. - - Scripting is allowed.
    >
    > in the Web.Config, I've got:
    > <authentication mode="Forms">
    > <forms name=".MyApp"
    > loginUrl="login.aspx"
    > protection="All"
    > timeout="480"
    > path="/"
    > />
    > </authentication>
    > <authorization>
    > <deny users ="?" />
    > </authorization>
    > And I'm importing the Web.Security Namespace on each page.
    > Does Each subsequent page need anything else in it to make this work?
    > Please help - - I've been working on this for over a week now! What am I
    > missing?
    >
    >

    John Saunders Guest

  8. #7

    Default Re: Forms Authentication Problem

    Hmmm,

    That website must be having some pretty big link problems! I had bookmarked
    it a long time ago. It looks like all their articles file links aren't
    working.

    Here's a line of code from a different article that I think pertains to you:

    If blnIsAuthenticated Then
    FormsAuthentication.RedirectFromLoginPage(strUser,
    chkPersistLogin.Checked)
    End If

    This article is using an xml file instead of a database to store usernames
    and passwords but the concept is the same. Here's the link:
    [url]http://www.15seconds.com/issue/020305.htm[/url]

    Sincerecly,


    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    news:eSDQlB3WDHA.1512@TK2MSFTNGP11.phx.gbl...
    > Thanks - I checked it out - - all the code listings links don't go to the
    > code at all....nice article, but it doesn't tell me where my problem is.
    > BTW - If I remove the deny users part - - - - it bypasses the login.aspx
    > file altogether. I at least had that working
    >
    >
    > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > news:%23razhf2WDHA.608@TK2MSFTNGP12.phx.gbl...
    > > Elmo,
    > >
    > > When you use a database with forms authentication you need to remove the
    > > deny users attribute in the web.config file. You then have to create a
    > > method that does the validation for you.
    > >
    > > Here's a good article about using a database with form authentication:
    > >
    >
    [url]http://www.zdnet.com.au/builder/program/windows/story/0,2000035027,20274191,00.htm[/url]
    > >
    > > Sincerely,
    > >
    > > --
    > > S. Justin Gengo, MCP
    > > Web Developer
    > >
    > > Free code library at:
    > > [url]www.aboutfortunate.com[/url]
    > >
    > > "Out of chaos comes order."
    > > Nietzche
    > > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > > I tried on the Security newgroup, as well as other places, and haven't
    > > > gotten an answer yet - - I'm pulling my hair out over this one.
    > > >
    > > > I'm trying to get Forms Authentication working.....I can get any
    > requested
    > > > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > > > querystring is correct in the address bar, but no matter what, I can't
    > get
    > > > it, once the user is authenticated, to redirect to the new page. It
    > ALWAYS
    > > > refreshes the Login.aspx page!
    > > >
    > > > My database has all the users - - I query the database and validate
    the
    > > user
    > > > there. This part works - - I've totally verified this.
    > > > Then - - I've got this:
    > > > if ValidUser="True" then
    > > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > > > <-------this is the part that DOES NOT work at all - - it never
    > redirects
    > > > the page
    > > >
    > > > The machine.config points to the correct path for the
    WebUIValidation.js
    > > > file....I'm using MSIE, as are all the other users who are going to be
    > > > hitting this app. - - Scripting is allowed.
    > > >
    > > > in the Web.Config, I've got:
    > > > <authentication mode="Forms">
    > > > <forms name=".MyApp"
    > > > loginUrl="login.aspx"
    > > > protection="All"
    > > > timeout="480"
    > > > path="/"
    > > > />
    > > > </authentication>
    > > > <authorization>
    > > > <deny users ="?" />
    > > > </authorization>
    > > > And I'm importing the Web.Security Namespace on each page.
    > > > Does Each subsequent page need anything else in it to make this work?
    > > > Please help - - I've been working on this for over a week now! What am
    I
    > > > missing?
    > > >
    > > >
    > >
    > >
    >
    >

    S. Justin Gengo Guest

  9. #8

    Default Re: Forms Authentication Problem

    Actually - I have had Tracing on & off several times - -
    I see that the cookie is set - - but the weird thing is how it's showing - -
    I went to the temporary internet files directory to watch when the cookie
    shows up.

    I run a page on the site in IE, get referred to the login page, login, and,
    as usual, it does NOT redirect me to the original page....
    Keep in mind, still no cookie in the directory -- then I close IE - - -
    still no cookie.
    THEN - when I start IE AGAIN, only going to its default page - - the cookie
    shows up in the directory - - I don't get how this behavior works, at all.

    Still - the same login scenario happens - - no redirect.

    You said:
    >>>>Maybe URL authorization has a typo in a role name, or roles aren't being
    applied in global.asax.

    I don't have any roles in play here - this scenario, at this point is
    supposed to check against a database table for authorization - - if
    there - - validuser is true, else it's false
    if it's true, I have it set like this:
    FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) and again -
    here's where it doesn't work. It DOES, however, set the cookie, named the
    same as in the web.config file.

    Anything else?? Nothing shows up as

    "John Saunders" <john.saunders@surfcontrol.com> wrote in message
    news:OLe4NF3WDHA.2272@TK2MSFTNGP11.phx.gbl...
    > Elmo,
    >
    > It may be redirecting to the page, then redirecting right back to the
    login
    > page when it's found that the user isn't authenticated.
    >
    > The question will be "why isn't the user authenticated when I think he
    > should be?" Answers I've seen include:
    >
    > 1) Because the cookie is set up wrong and Forms Authentication never sees
    > it. Check on the domain, path and expiration of the cookie. In particular,
    > make sure the cookie domain matches your domain. localhost has a blank
    > domain, BTW.
    > 2) Because the login page and the page you're redirecting to have
    different
    > values in the <machineKey> entry in machine.config or web.config.
    > 3) The user _is_ authenticated, but not authorized. Maybe URL
    authorization
    > has a typo in a role name, or roles aren't being applied in global.asax.
    >
    > It sounds like it's time for you to look one layer deeper. In particular,
    > try turning on tracing in web.config:
    >
    > <trace enabled="true" requestLimit="100" pageOutput="false"
    > traceMode="SortByTime" localOnly="true" />
    >
    > Then reproduce the problem and navigate to
    > [url]http://localhost/yourSite/trace.axd[/url]. It may be instructive.
    > --
    > John Saunders
    > Internet Engineer
    > [email]john.saunders@surfcontrol.com[/email]
    >
    >
    >
    > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > I tried on the Security newgroup, as well as other places, and haven't
    > > gotten an answer yet - - I'm pulling my hair out over this one.
    > >
    > > I'm trying to get Forms Authentication working.....I can get any
    requested
    > > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > > querystring is correct in the address bar, but no matter what, I can't
    get
    > > it, once the user is authenticated, to redirect to the new page. It
    ALWAYS
    > > refreshes the Login.aspx page!
    > >
    > > My database has all the users - - I query the database and validate the
    > user
    > > there. This part works - - I've totally verified this.
    > > Then - - I've got this:
    > > if ValidUser="True" then
    > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > > <-------this is the part that DOES NOT work at all - - it never
    redirects
    > > the page
    > >
    > > The machine.config points to the correct path for the WebUIValidation.js
    > > file....I'm using MSIE, as are all the other users who are going to be
    > > hitting this app. - - Scripting is allowed.
    > >
    > > in the Web.Config, I've got:
    > > <authentication mode="Forms">
    > > <forms name=".MyApp"
    > > loginUrl="login.aspx"
    > > protection="All"
    > > timeout="480"
    > > path="/"
    > > />
    > > </authentication>
    > > <authorization>
    > > <deny users ="?" />
    > > </authorization>
    > > And I'm importing the Web.Security Namespace on each page.
    > > Does Each subsequent page need anything else in it to make this work?
    > > Please help - - I've been working on this for over a week now! What am I
    > > missing?
    > >
    > >
    >
    >

    ElmoWatson Guest

  10. #9

    Default Re: Forms Authentication Problem

    Yeah - - that's what I'm using exactly - - that's what doesn't work
    correctly
    I'm totally lost here......I guess I'll just have to roll my own
    authentication system - - I've been at this over a week and I could have had
    it all done, if I had manually created it.

    Thanks for the help - - if you think of something else - - - post back,
    please.

    "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    news:%23XKtLK3WDHA.1480@tk2msftngp13.phx.gbl...
    > Hmmm,
    >
    > That website must be having some pretty big link problems! I had
    bookmarked
    > it a long time ago. It looks like all their articles file links aren't
    > working.
    >
    > Here's a line of code from a different article that I think pertains to
    you:
    >
    > If blnIsAuthenticated Then
    > FormsAuthentication.RedirectFromLoginPage(strUser,
    > chkPersistLogin.Checked)
    > End If
    >
    > This article is using an xml file instead of a database to store usernames
    > and passwords but the concept is the same. Here's the link:
    > [url]http://www.15seconds.com/issue/020305.htm[/url]
    >
    > Sincerecly,
    >
    >
    > --
    > S. Justin Gengo, MCP
    > Web Developer
    >
    > Free code library at:
    > [url]www.aboutfortunate.com[/url]
    >
    > "Out of chaos comes order."
    > Nietzche
    > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > news:eSDQlB3WDHA.1512@TK2MSFTNGP11.phx.gbl...
    > > Thanks - I checked it out - - all the code listings links don't go to
    the
    > > code at all....nice article, but it doesn't tell me where my problem is.
    > > BTW - If I remove the deny users part - - - - it bypasses the
    login.aspx
    > > file altogether. I at least had that working
    > >
    > >
    > > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > > news:%23razhf2WDHA.608@TK2MSFTNGP12.phx.gbl...
    > > > Elmo,
    > > >
    > > > When you use a database with forms authentication you need to remove
    the
    > > > deny users attribute in the web.config file. You then have to create a
    > > > method that does the validation for you.
    > > >
    > > > Here's a good article about using a database with form authentication:
    > > >
    > >
    >
    [url]http://www.zdnet.com.au/builder/program/windows/story/0,2000035027,20274191,00.htm[/url]
    > > >
    > > > Sincerely,
    > > >
    > > > --
    > > > S. Justin Gengo, MCP
    > > > Web Developer
    > > >
    > > > Free code library at:
    > > > [url]www.aboutfortunate.com[/url]
    > > >
    > > > "Out of chaos comes order."
    > > > Nietzche
    > > > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > > > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > > > I tried on the Security newgroup, as well as other places, and
    haven't
    > > > > gotten an answer yet - - I'm pulling my hair out over this one.
    > > > >
    > > > > I'm trying to get Forms Authentication working.....I can get any
    > > requested
    > > > > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > > > > querystring is correct in the address bar, but no matter what, I
    can't
    > > get
    > > > > it, once the user is authenticated, to redirect to the new page. It
    > > ALWAYS
    > > > > refreshes the Login.aspx page!
    > > > >
    > > > > My database has all the users - - I query the database and validate
    > the
    > > > user
    > > > > there. This part works - - I've totally verified this.
    > > > > Then - - I've got this:
    > > > > if ValidUser="True" then
    > > > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > > > > <-------this is the part that DOES NOT work at all - - it never
    > > redirects
    > > > > the page
    > > > >
    > > > > The machine.config points to the correct path for the
    > WebUIValidation.js
    > > > > file....I'm using MSIE, as are all the other users who are going to
    be
    > > > > hitting this app. - - Scripting is allowed.
    > > > >
    > > > > in the Web.Config, I've got:
    > > > > <authentication mode="Forms">
    > > > > <forms name=".MyApp"
    > > > > loginUrl="login.aspx"
    > > > > protection="All"
    > > > > timeout="480"
    > > > > path="/"
    > > > > />
    > > > > </authentication>
    > > > > <authorization>
    > > > > <deny users ="?" />
    > > > > </authorization>
    > > > > And I'm importing the Web.Security Namespace on each page.
    > > > > Does Each subsequent page need anything else in it to make this
    work?
    > > > > Please help - - I've been working on this for over a week now! What
    am
    > I
    > > > > missing?
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    ElmoWatson Guest

  11. #10

    Default Re: Forms Authentication Problem

    Elmo,

    Let's be sure we understand each other. Here's a sequence of events to
    reproduce:

    1) Close _all_ of your browsers
    2) Start up IE (preferably with your home page set to about:blank).
    3) Navigate to a page which requires you to be authenticated
    4) You should be redirected to the login page
    5) Check for the cookie it should be absent.
    6) Log in. It should attempt to redirect you to the original page.
    7) Whether or not it redirected you, check for the cookie again. If it's
    there, post the details, in particular, the path, domain and expiration.

    BTW, I don't know how you're seeing the cookie at all. Session cookies
    aren't displayed in IE's "View Files" dialog. You'd do better to use a tool
    like ProxyTrace from [url]http://pocketsoap.com[/url], which will allow you to see the
    actual Set-Cookie header(s).
    --
    John Saunders
    Internet Engineer
    [email]john.saunders@surfcontrol.com[/email]


    "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    news:eX0gGh3WDHA.1640@TK2MSFTNGP10.phx.gbl...
    > Actually - I have had Tracing on & off several times - -
    > I see that the cookie is set - - but the weird thing is how it's
    showing - -
    > I went to the temporary internet files directory to watch when the cookie
    > shows up.
    >
    > I run a page on the site in IE, get referred to the login page, login,
    and,
    > as usual, it does NOT redirect me to the original page....
    > Keep in mind, still no cookie in the directory -- then I close IE - - -
    > still no cookie.
    > THEN - when I start IE AGAIN, only going to its default page - - the
    cookie
    > shows up in the directory - - I don't get how this behavior works, at
    all.
    >
    > Still - the same login scenario happens - - no redirect.
    >
    > You said:
    > >>>>Maybe URL authorization has a typo in a role name, or roles aren't
    being
    > applied in global.asax.
    >
    > I don't have any roles in play here - this scenario, at this point is
    > supposed to check against a database table for authorization - - if
    > there - - validuser is true, else it's false
    > if it's true, I have it set like this:
    > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) and again -
    > here's where it doesn't work. It DOES, however, set the cookie, named the
    > same as in the web.config file.
    >
    > Anything else?? Nothing shows up as
    >
    > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
    > news:OLe4NF3WDHA.2272@TK2MSFTNGP11.phx.gbl...
    > > Elmo,
    > >
    > > It may be redirecting to the page, then redirecting right back to the
    > login
    > > page when it's found that the user isn't authenticated.
    > >
    > > The question will be "why isn't the user authenticated when I think he
    > > should be?" Answers I've seen include:
    > >
    > > 1) Because the cookie is set up wrong and Forms Authentication never
    sees
    > > it. Check on the domain, path and expiration of the cookie. In
    particular,
    > > make sure the cookie domain matches your domain. localhost has a blank
    > > domain, BTW.
    > > 2) Because the login page and the page you're redirecting to have
    > different
    > > values in the <machineKey> entry in machine.config or web.config.
    > > 3) The user _is_ authenticated, but not authorized. Maybe URL
    > authorization
    > > has a typo in a role name, or roles aren't being applied in global.asax.
    > >
    > > It sounds like it's time for you to look one layer deeper. In
    particular,
    > > try turning on tracing in web.config:
    > >
    > > <trace enabled="true" requestLimit="100" pageOutput="false"
    > > traceMode="SortByTime" localOnly="true" />
    > >
    > > Then reproduce the problem and navigate to
    > > [url]http://localhost/yourSite/trace.axd[/url]. It may be instructive.
    > > --
    > > John Saunders
    > > Internet Engineer
    > > [email]john.saunders@surfcontrol.com[/email]
    > >
    > >
    > >
    > > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > > I tried on the Security newgroup, as well as other places, and haven't
    > > > gotten an answer yet - - I'm pulling my hair out over this one.
    > > >
    > > > I'm trying to get Forms Authentication working.....I can get any
    > requested
    > > > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > > > querystring is correct in the address bar, but no matter what, I can't
    > get
    > > > it, once the user is authenticated, to redirect to the new page. It
    > ALWAYS
    > > > refreshes the Login.aspx page!
    > > >
    > > > My database has all the users - - I query the database and validate
    the
    > > user
    > > > there. This part works - - I've totally verified this.
    > > > Then - - I've got this:
    > > > if ValidUser="True" then
    > > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > > > <-------this is the part that DOES NOT work at all - - it never
    > redirects
    > > > the page
    > > >
    > > > The machine.config points to the correct path for the
    WebUIValidation.js
    > > > file....I'm using MSIE, as are all the other users who are going to be
    > > > hitting this app. - - Scripting is allowed.
    > > >
    > > > in the Web.Config, I've got:
    > > > <authentication mode="Forms">
    > > > <forms name=".MyApp"
    > > > loginUrl="login.aspx"
    > > > protection="All"
    > > > timeout="480"
    > > > path="/"
    > > > />
    > > > </authentication>
    > > > <authorization>
    > > > <deny users ="?" />
    > > > </authorization>
    > > > And I'm importing the Web.Security Namespace on each page.
    > > > Does Each subsequent page need anything else in it to make this work?
    > > > Please help - - I've been working on this for over a week now! What am
    I
    > > > missing?
    > > >
    > > >
    > >
    > >
    >
    >

    John Saunders Guest

  12. #11

    Default Re: Forms Authentication Problem

    Here are my steps
    1. Delete existing cookie, starting from scratch
    2. Run a page on web server - - redirects me to login page
    3. Login, hoping to go to url in querystring
    4. It does NOT redirect me to the correct page - -
    in the Trace details, it shows the cookie with the correct name (from
    Web.Config Name = section)
    5. However, I don't see the cookie in the Temporary Internet Files dir
    yet - - close IE -no cookie
    6. Start IE (goes to default site which is NOT the web site in question) -
    Cookie shows up
    7. Details - - - in the directory list (Windows Explorer):
    Name: Cookie:myname@testWebserver/ --- this is correct --
    Internet Address - same as Name: - TXT file
    Expires: 8/5/2053
    Last Modified/Last Accessed/Last Checked - - all the same time/date (today)

    8. Try running a page on the web server again - - redirects me to login
    page, with the originally requested page, correctly, in the querystring
    (ReturnUrL) - - cookie shows up with the name given to it, in my Web.config
    file.

    Does this show you anything?

    "John Saunders" <john.saunders@surfcontrol.com> wrote in message
    news:uGP7F43WDHA.2080@TK2MSFTNGP11.phx.gbl...
    > Elmo,
    >
    > Let's be sure we understand each other. Here's a sequence of events to
    > reproduce:
    >
    > 1) Close _all_ of your browsers
    > 2) Start up IE (preferably with your home page set to about:blank).
    > 3) Navigate to a page which requires you to be authenticated
    > 4) You should be redirected to the login page
    > 5) Check for the cookie it should be absent.
    > 6) Log in. It should attempt to redirect you to the original page.
    > 7) Whether or not it redirected you, check for the cookie again. If it's
    > there, post the details, in particular, the path, domain and expiration.
    >
    > BTW, I don't know how you're seeing the cookie at all. Session cookies
    > aren't displayed in IE's "View Files" dialog. You'd do better to use a
    tool
    > like ProxyTrace from [url]http://pocketsoap.com[/url], which will allow you to see
    the
    > actual Set-Cookie header(s).
    > --
    > John Saunders
    > Internet Engineer
    > [email]john.saunders@surfcontrol.com[/email]
    >
    >
    > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > news:eX0gGh3WDHA.1640@TK2MSFTNGP10.phx.gbl...
    > > Actually - I have had Tracing on & off several times - -
    > > I see that the cookie is set - - but the weird thing is how it's
    > showing - -
    > > I went to the temporary internet files directory to watch when the
    cookie
    > > shows up.
    > >
    > > I run a page on the site in IE, get referred to the login page, login,
    > and,
    > > as usual, it does NOT redirect me to the original page....
    > > Keep in mind, still no cookie in the directory -- then I close IE - - -
    > > still no cookie.
    > > THEN - when I start IE AGAIN, only going to its default page - - the
    > cookie
    > > shows up in the directory - - I don't get how this behavior works, at
    > all.
    > >
    > > Still - the same login scenario happens - - no redirect.
    > >
    > > You said:
    > > >>>>Maybe URL authorization has a typo in a role name, or roles aren't
    > being
    > > applied in global.asax.
    > >
    > > I don't have any roles in play here - this scenario, at this point is
    > > supposed to check against a database table for authorization - - if
    > > there - - validuser is true, else it's false
    > > if it's true, I have it set like this:
    > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) and again -
    > > here's where it doesn't work. It DOES, however, set the cookie, named
    the
    > > same as in the web.config file.
    > >
    > > Anything else?? Nothing shows up as
    > >
    > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
    > > news:OLe4NF3WDHA.2272@TK2MSFTNGP11.phx.gbl...
    > > > Elmo,
    > > >
    > > > It may be redirecting to the page, then redirecting right back to the
    > > login
    > > > page when it's found that the user isn't authenticated.
    > > >
    > > > The question will be "why isn't the user authenticated when I think he
    > > > should be?" Answers I've seen include:
    > > >
    > > > 1) Because the cookie is set up wrong and Forms Authentication never
    > sees
    > > > it. Check on the domain, path and expiration of the cookie. In
    > particular,
    > > > make sure the cookie domain matches your domain. localhost has a blank
    > > > domain, BTW.
    > > > 2) Because the login page and the page you're redirecting to have
    > > different
    > > > values in the <machineKey> entry in machine.config or web.config.
    > > > 3) The user _is_ authenticated, but not authorized. Maybe URL
    > > authorization
    > > > has a typo in a role name, or roles aren't being applied in
    global.asax.
    > > >
    > > > It sounds like it's time for you to look one layer deeper. In
    > particular,
    > > > try turning on tracing in web.config:
    > > >
    > > > <trace enabled="true" requestLimit="100" pageOutput="false"
    > > > traceMode="SortByTime" localOnly="true" />
    > > >
    > > > Then reproduce the problem and navigate to
    > > > [url]http://localhost/yourSite/trace.axd[/url]. It may be instructive.
    > > > --
    > > > John Saunders
    > > > Internet Engineer
    > > > [email]john.saunders@surfcontrol.com[/email]
    > > >
    > > >
    > > >
    > > > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > > > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > > > I tried on the Security newgroup, as well as other places, and
    haven't
    > > > > gotten an answer yet - - I'm pulling my hair out over this one.
    > > > >
    > > > > I'm trying to get Forms Authentication working.....I can get any
    > > requested
    > > > > page to automatically go to the Login.aspx page, AND, the ReturnURL
    > > > > querystring is correct in the address bar, but no matter what, I
    can't
    > > get
    > > > > it, once the user is authenticated, to redirect to the new page. It
    > > ALWAYS
    > > > > refreshes the Login.aspx page!
    > > > >
    > > > > My database has all the users - - I query the database and validate
    > the
    > > > user
    > > > > there. This part works - - I've totally verified this.
    > > > > Then - - I've got this:
    > > > > if ValidUser="True" then
    > > > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) '
    > > > > <-------this is the part that DOES NOT work at all - - it never
    > > redirects
    > > > > the page
    > > > >
    > > > > The machine.config points to the correct path for the
    > WebUIValidation.js
    > > > > file....I'm using MSIE, as are all the other users who are going to
    be
    > > > > hitting this app. - - Scripting is allowed.
    > > > >
    > > > > in the Web.Config, I've got:
    > > > > <authentication mode="Forms">
    > > > > <forms name=".MyApp"
    > > > > loginUrl="login.aspx"
    > > > > protection="All"
    > > > > timeout="480"
    > > > > path="/"
    > > > > />
    > > > > </authentication>
    > > > > <authorization>
    > > > > <deny users ="?" />
    > > > > </authorization>
    > > > > And I'm importing the Web.Security Namespace on each page.
    > > > > Does Each subsequent page need anything else in it to make this
    work?
    > > > > Please help - - I've been working on this for over a week now! What
    am
    > I
    > > > > missing?
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    ElmoWatson Guest

  13. #12

    Default Re: Forms Authentication Problem

    Yeah, Elmo, that's what I figured from your detailed post. Your Forms
    Authentication page may be using the same cookie name as being used by that
    "classic ASP" page. Choose another name!

    You're not _supposed_ to be able to see session cookies in Temporary
    Internet Files! The fact that you saw it there suggested that it wasn't from
    ASP.NET, and the fact that you saw it after going to the "default" page
    suggested that you were getting that cookie from the default page.

    --
    John Saunders
    Internet Engineer
    [email]john.saunders@surfcontrol.com[/email]


    "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    news:u8NICn4WDHA.1680@tk2msftngp13.phx.gbl...
    > I didn't notice until I sent the last message, that you said to 'blank'
    out
    > the start page....
    > The weirdest thing happened - - previously, my start page was one of the
    > other intranet's login page in our company (classic asp/different
    > login/different server/completely different physical location) - - -
    >
    > AS SOON as I dumped that page from my default page in IE - the whole Forms
    > Authentication worked perfectly - just like it was supposed to.
    >
    >
    >
    > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > news:ewZKdC4WDHA.608@TK2MSFTNGP12.phx.gbl...
    > > Here are my steps
    > > 1. Delete existing cookie, starting from scratch
    > > 2. Run a page on web server - - redirects me to login page
    > > 3. Login, hoping to go to url in querystring
    > > 4. It does NOT redirect me to the correct page - -
    > > in the Trace details, it shows the cookie with the correct name (from
    > > Web.Config Name = section)
    > > 5. However, I don't see the cookie in the Temporary Internet Files dir
    > > yet - - close IE -no cookie
    > > 6. Start IE (goes to default site which is NOT the web site in
    question) -
    > > Cookie shows up
    > > 7. Details - - - in the directory list (Windows Explorer):
    > > Name: Cookie:myname@testWebserver/ --- this is correct --
    > > Internet Address - same as Name: - TXT file
    > > Expires: 8/5/2053
    > > Last Modified/Last Accessed/Last Checked - - all the same time/date
    > (today)
    > >
    > > 8. Try running a page on the web server again - - redirects me to login
    > > page, with the originally requested page, correctly, in the querystring
    > > (ReturnUrL) - - cookie shows up with the name given to it, in my
    > Web.config
    > > file.
    > >
    > > Does this show you anything?
    > >
    > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
    > > news:uGP7F43WDHA.2080@TK2MSFTNGP11.phx.gbl...
    > > > Elmo,
    > > >
    > > > Let's be sure we understand each other. Here's a sequence of events to
    > > > reproduce:
    > > >
    > > > 1) Close _all_ of your browsers
    > > > 2) Start up IE (preferably with your home page set to about:blank).
    > > > 3) Navigate to a page which requires you to be authenticated
    > > > 4) You should be redirected to the login page
    > > > 5) Check for the cookie it should be absent.
    > > > 6) Log in. It should attempt to redirect you to the original page.
    > > > 7) Whether or not it redirected you, check for the cookie again. If
    it's
    > > > there, post the details, in particular, the path, domain and
    expiration.
    > > >
    > > > BTW, I don't know how you're seeing the cookie at all. Session cookies
    > > > aren't displayed in IE's "View Files" dialog. You'd do better to use a
    > > tool
    > > > like ProxyTrace from [url]http://pocketsoap.com[/url], which will allow you to
    see
    > > the
    > > > actual Set-Cookie header(s).
    > > > --
    > > > John Saunders
    > > > Internet Engineer
    > > > [email]john.saunders@surfcontrol.com[/email]
    > > >
    > > >
    > > > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > > > news:eX0gGh3WDHA.1640@TK2MSFTNGP10.phx.gbl...
    > > > > Actually - I have had Tracing on & off several times - -
    > > > > I see that the cookie is set - - but the weird thing is how it's
    > > > showing - -
    > > > > I went to the temporary internet files directory to watch when the
    > > cookie
    > > > > shows up.
    > > > >
    > > > > I run a page on the site in IE, get referred to the login page,
    login,
    > > > and,
    > > > > as usual, it does NOT redirect me to the original page....
    > > > > Keep in mind, still no cookie in the directory -- then I close
    > IE - - -
    > > > > still no cookie.
    > > > > THEN - when I start IE AGAIN, only going to its default page - - the
    > > > cookie
    > > > > shows up in the directory - - I don't get how this behavior works,
    > at
    > > > all.
    > > > >
    > > > > Still - the same login scenario happens - - no redirect.
    > > > >
    > > > > You said:
    > > > > >>>>Maybe URL authorization has a typo in a role name, or roles
    aren't
    > > > being
    > > > > applied in global.asax.
    > > > >
    > > > > I don't have any roles in play here - this scenario, at this point
    is
    > > > > supposed to check against a database table for authorization - - if
    > > > > there - - validuser is true, else it's false
    > > > > if it's true, I have it set like this:
    > > > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True) and
    > again -
    > > > > here's where it doesn't work. It DOES, however, set the cookie,
    named
    > > the
    > > > > same as in the web.config file.
    > > > >
    > > > > Anything else?? Nothing shows up as
    > > > >
    > > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
    > > > > news:OLe4NF3WDHA.2272@TK2MSFTNGP11.phx.gbl...
    > > > > > Elmo,
    > > > > >
    > > > > > It may be redirecting to the page, then redirecting right back to
    > the
    > > > > login
    > > > > > page when it's found that the user isn't authenticated.
    > > > > >
    > > > > > The question will be "why isn't the user authenticated when I
    think
    > he
    > > > > > should be?" Answers I've seen include:
    > > > > >
    > > > > > 1) Because the cookie is set up wrong and Forms Authentication
    never
    > > > sees
    > > > > > it. Check on the domain, path and expiration of the cookie. In
    > > > particular,
    > > > > > make sure the cookie domain matches your domain. localhost has a
    > blank
    > > > > > domain, BTW.
    > > > > > 2) Because the login page and the page you're redirecting to have
    > > > > different
    > > > > > values in the <machineKey> entry in machine.config or web.config.
    > > > > > 3) The user _is_ authenticated, but not authorized. Maybe URL
    > > > > authorization
    > > > > > has a typo in a role name, or roles aren't being applied in
    > > global.asax.
    > > > > >
    > > > > > It sounds like it's time for you to look one layer deeper. In
    > > > particular,
    > > > > > try turning on tracing in web.config:
    > > > > >
    > > > > > <trace enabled="true" requestLimit="100" pageOutput="false"
    > > > > > traceMode="SortByTime" localOnly="true" />
    > > > > >
    > > > > > Then reproduce the problem and navigate to
    > > > > > [url]http://localhost/yourSite/trace.axd[/url]. It may be instructive.
    > > > > > --
    > > > > > John Saunders
    > > > > > Internet Engineer
    > > > > > [email]john.saunders@surfcontrol.com[/email]
    > > > > >
    > > > > >
    > > > > >
    > > > > > "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    > > > > > news:%23qyCYV2WDHA.2376@TK2MSFTNGP11.phx.gbl...
    > > > > > > I tried on the Security newgroup, as well as other places, and
    > > haven't
    > > > > > > gotten an answer yet - - I'm pulling my hair out over this one.
    > > > > > >
    > > > > > > I'm trying to get Forms Authentication working.....I can get any
    > > > > requested
    > > > > > > page to automatically go to the Login.aspx page, AND, the
    > ReturnURL
    > > > > > > querystring is correct in the address bar, but no matter what, I
    > > can't
    > > > > get
    > > > > > > it, once the user is authenticated, to redirect to the new page.
    > It
    > > > > ALWAYS
    > > > > > > refreshes the Login.aspx page!
    > > > > > >
    > > > > > > My database has all the users - - I query the database and
    > validate
    > > > the
    > > > > > user
    > > > > > > there. This part works - - I've totally verified this.
    > > > > > > Then - - I've got this:
    > > > > > > if ValidUser="True" then
    > > > > > > FormsAuthentication.RedirectFromLoginPage(txtUID.t ext, True)
    '
    > > > > > > <-------this is the part that DOES NOT work at all - - it never
    > > > > redirects
    > > > > > > the page
    > > > > > >
    > > > > > > The machine.config points to the correct path for the
    > > > WebUIValidation.js
    > > > > > > file....I'm using MSIE, as are all the other users who are going
    > to
    > > be
    > > > > > > hitting this app. - - Scripting is allowed.
    > > > > > >
    > > > > > > in the Web.Config, I've got:
    > > > > > > <authentication mode="Forms">
    > > > > > > <forms name=".MyApp"
    > > > > > > loginUrl="login.aspx"
    > > > > > > protection="All"
    > > > > > > timeout="480"
    > > > > > > path="/"
    > > > > > > />
    > > > > > > </authentication>
    > > > > > > <authorization>
    > > > > > > <deny users ="?" />
    > > > > > > </authorization>
    > > > > > > And I'm importing the Web.Security Namespace on each page.
    > > > > > > Does Each subsequent page need anything else in it to make this
    > > work?
    > > > > > > Please help - - I've been working on this for over a week now!
    > What
    > > am
    > > > I
    > > > > > > missing?
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    John Saunders Guest

  14. #13

    Default forms authentication problem

    I have implemented forms authentication which works fine as tested from a
    browser on my dev machine. Now that I am ready to deploy I am noticeing a
    problem. Any other computer that accesses the site served by IIS from my
    machine gets an Windows Authentication prompt but only on certain pages. For
    example after logging in through forms the home page loads fine but when
    going to another page from the menu the Windows login pops up. What could be
    the problem?

    Perry


    Perecli Manole Guest

  15. #14

    Default Forms Authentication Problem

    Hi Everyone...

    I have a strange problem..
    I managed to perform authentication (cookie & cookieless ) and
    get redirected to a default page, but when i try to move to
    another page within the protected area, i get prompted for the login
    page again...

    My Web.Cofig in the authorization section looks like this :

    <authorization>
    <deny users="?" />
    </authorization>

    Any suggestions would be appreciated..
    Thanks in advance...
    keeper7k Guest

  16. #15

    Default Re: Forms Authentication Problem

    Are the pages you are redirecting to in the same web app? If not, you need
    to set the MachineKey value in the machine.config file to not be
    automatically assigned. This causes each site to get its own
    encrypt/decrypt keys causing each site to need it's own authentication. You
    can info on how to set the keys here:
    [url]http://support.microsoft.com/default.aspx?scid=kb;EN-US;312906[/url]

    HTH,
    Jeff

    "keeper7k" <keeper7k@no.spam.com> wrote in message
    news:MPG.1a2c1befca02574f989680@news.otenet.gr...
    > Hi Everyone...
    >
    > I have a strange problem..
    > I managed to perform authentication (cookie & cookieless ) and
    > get redirected to a default page, but when i try to move to
    > another page within the protected area, i get prompted for the login
    > page again...
    >
    > My Web.Cofig in the authorization section looks like this :
    >
    > <authorization>
    > <deny users="?" />
    > </authorization>
    >
    > Any suggestions would be appreciated..
    > Thanks in advance...

    Jeff Guest

  17. #16

    Default FORMS AUTHENTICATION PROBLEM

    Hi,

    I have problem with my application and I don't know how to solve it.
    I am using forms authentication to secure some subdirectories. When I want
    to access MojeAukcje.aspx I am redirected to the Login.aspx what I obviously
    inteded, but after typing correct login and password I am still redirected
    to the Login.aspx and not to MojeAukcje.aspx as I would like to be.

    My web.config file is in the root directory Aukcja, its code:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <system.web>
    <compilation defaultLanguage="c#" debug="true" />
    <customErrors mode="RemotUOnly" />
    <authentication mode="Forms">
    <forms name=".NoweCiacho"
    loginUrl="http://lokalhost/Aukcja/Login/Login.aspx" />
    </authentication>
    <authorization>
    <allow users="*" />
    </authorization>
    <trace enbled="false" requestLimit="10" pageOutput="false"
    treMode="SortByTime" localOnly="true" />
    <sessionState mode="InProc" stateConnectionString="tpip=127.0.0.1:42424"
    sqlConnUctionString="datL soure=127.0.0.1;user id=sa;password="
    cookielU,s="false" timeout="20" />
    <globalization requestEncoding="utf-8" responsUEncoding="utf-8" />
    </system.web>
    <location path="Login">
    <system.web>
    <authorization>
    <allow users="*" />
    </authorization>
    </system.web>
    </location>
    <location path="NewUser">
    <system.web>
    <authorization>
    <allow users="*" />
    </authorization>
    </system.web>
    </location>
    <location path="MojeAukcje">
    <system.web>
    <authorization>
    <deny users="?" />
    </authorization>
    </system.web>
    </location>
    </configuration>

    My Login.aspx.cs file I have:
    .........
    private void BtZatwierdz_Click(object sender, System.EventArgs e)
    {
    LogowanieProc.Parameters["@login"].Value = TBLogin.Text;
    LogowanieProc.Parameters["@haslo"].Value =
    FormsAuthentication.HashPasswordForStoringInConfig File(TBHaslo.Text,"MD5");

    LogowanieProc.Connection.Open();
    LogowanieProc.ExecuteReader();
    LogowanieProc.Connection.Close();

    if (LogowanieProc.Parameters["@wynik"].Value.ToString() == "1") // if
    password and login are correct it will be true
    {
    HttpCookie cookie = new HttpCookie(".NoweCiacho");
    cookie.Expires = DateTime.Now.AddMinutes(10);
    cookie["user"] = TBLogin.Text;
    Response.Cookies.Add(cookie);

    string returnUrl = Request.QueryString["ReturnUrl"];

    if (returnUrl == null)
    returnUrl = "http://localhost/Aukcja/troll.aspx";
    Response.Redirect(returnUrl);
    }
    else
    {
    LbBlad.Text = "Nieprawidłowy login lub hasło. "; //Incorrect login or
    password
    }
    }
    .........

    Where is my mistake? Can anybody tell me, pls.

    Rafi



    Rafi Guest

  18. #17

    Default RE: FORMS AUTHENTICATION PROBLEM

    After you've verified the user's password and login are correct, you need
    to execute "FormsAuthentication.RedirectFromLoginPage(... )". This will
    auto-generate a cookie which holds an authentication ticket. You don't
    need to create one explicitly unless you want to add some additional info
    to the ticket.

    ----------------------------------------------------------------------------
    -------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.

    Mark Berryman Guest

  19. #18

    Default Forms Authentication Problem

    Hi,

    May I know how can I use Forms Authentication without storing my
    credentials information in web.Config but in some other Xml file of my own .
    Since I am creating users at runtime I need to store username and passwords
    in a different xml file which i need to use to authenticate the users. But
    how do i inform Forms Authentication about this b'coz as far as i know it
    searches the credentials section in Web.Config file for authenticating the
    users.

    Any advice would be helpful.

    thanx,
    smita.




    smita Guest

  20. #19

    Default Re: Forms Authentication Problem

    Take a look at this article, may be of some help.

    [url]http://www.theserverside.net/articles/article.aspx?l=FormAuthentication[/url]


    --
    Hernan de Lahitte - MSDE
    Lagash Systems S.A. - Buenos Aires, Argentina
    [url]http://www.lagash.com[/url]



    "keeper7k" <keeper7k@no.spam.com> wrote in message
    news:MPG.1a2c1befca02574f989680@news.otenet.gr...
    > Hi Everyone...
    >
    > I have a strange problem..
    > I managed to perform authentication (cookie & cookieless ) and
    > get redirected to a default page, but when i try to move to
    > another page within the protected area, i get prompted for the login
    > page again...
    >
    > My Web.Cofig in the authorization section looks like this :
    >
    > <authorization>
    > <deny users="?" />
    > </authorization>
    >
    > Any suggestions would be appreciated..
    > Thanks in advance...

    Hernan de Lahitte Guest

  21. #20

    Default Re: Forms Authentication Problem

    I don´t know why you want to store user credentials in a xml file (despite
    you can do it with forms auth) but I definitely don´t recommend you this
    practice. I think that is not possible with forms auth to store the creds
    outside the web.config file but you might implement your own auth scheme
    with the file you want.

    --
    Hernan de Lahitte - MSDE
    Lagash Systems S.A. - Buenos Aires, Argentina
    [url]http://www.lagash.com[/url]



    "smita" <smita@rarefind.com> wrote in message
    news:#4fhZhN4DHA.1596@TK2MSFTNGP10.phx.gbl...
    > Hi,
    >
    > May I know how can I use Forms Authentication without storing my
    > credentials information in web.Config but in some other Xml file of my own
    ..
    > Since I am creating users at runtime I need to store username and
    passwords
    > in a different xml file which i need to use to authenticate the users. But
    > how do i inform Forms Authentication about this b'coz as far as i know it
    > searches the credentials section in Web.Config file for authenticating the
    > users.
    >
    > Any advice would be helpful.
    >
    > thanx,
    > smita.
    >
    >
    >
    >

    Hernan de Lahitte 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