Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2003, 03:26 AM
Registered User
 
Join Date: Sep 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forms authentication pblm...

Basically iam using forms authentication in my project....

This is what my web.config looks like...

<system.web>
    <compilation defaultLanguage="c#" debug="true" />
    <authentication mode="Forms">
            <forms name="_MyAuthCookie" loginUrl="Login.aspx" />
    </authentication>

      <authorization>

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

  </system.web>

in global.aspx section

In the forms authenticationsection iam checking like this....

protected void Application_AuthenticateRequest(Object sender, EventArgs e)
        {
            HttpCookie authcookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            if (authcookie != null)
            {
                string cookiedata = authcookie.Value;
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookiedata);
                string userdata = ticket.UserData;

                XmlSerializer xs = new XmlSerializer(typeof(UserAuthInfo));
                StringReader sr = new StringReader(userdata);
                UserAuthInfo uai = (UserAuthInfo) xs.Deserialize(sr);

                GenericIdentity iden = new GenericIdentity(ticket.Name);
                Context.User = new GenericPrincipal(iden, uai.Roles);
                Context.Items["UserAuthInfo"] = uai;
            }

it is working fine... if i enter directly the second page of the form it is redirecting me to the login page. my problem is even iam having link in my login page for new user to register... even i click on that link it is redirecting me to the login page... iam not able to track where should i check it is from login page only... hope u got my problem.... plz help me in this..

thanks in advance
vishnu

 
Old October 15th, 2003, 09:46 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Ah... you are suffering from the "work's as designed" bug.

What you need to do is create a publicly accessible directory in your web application where you can put any pages that need NOT be authenticated.

1. Create a new directory in your web application (maybe call is "public" for lack of a more ambiguous term.)
2. Put a BLANK web.config file in there.
3. Put the following into this new web.config:
<configuration>
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
</configuration>
4. Put your register.aspx page into this directory.

The web.config in this directory will override the settings at the root of the application, thus allowing any user to see the pages in this directory. Only files in this directory will be visible to unauthenticated users.

Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms Authentication thetway Classic ASP Basics 1 August 18th, 2005 05:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.