Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution 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 May 27th, 2005, 05:37 PM
Registered User
 
Join Date: Jul 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forms Authentication Woes

Forms Authentication worked great forever...Unitl i upgraded to 1.1 and vs.net 2003

The Code I have in the page load of every protected page is:

If Context.User.Identity.IsAuthenticated Then
     If Not (TypeOf context.User Is SitePrincipal) Then
       Dim newUser As New SitePrincipal Context.User.Identity.Name)
       Context.User = newUser
     End If
End If

If Not (TypeOf Context.User Is SitePrincipal) _
     OrElse Not CType(Context.User,
     Accounts.Business.SitePrincipal).HasPermission( _
        CInt(SupervisorPermissions.ViewForms)) Then
           Response.Redirect( _
   "/ThePhileVB/WebModules/Accounts/Login.aspx? ShowError=true", True)
End If

Well now, when I login to via login.aspx my FormsAuthentication.SetAuthCookie(EmailAddress.Tex t, False) and a cookie is indeed set in my \cookies directory as usual. However as soon as i navigate away from the login.aspx page Context.User.Identity.IsAuthenticated is always false!!
its like the authentication isn't happening!

I cant' figure it out! web.config is the way it always has been :
  <authentication mode="Forms" >
        <forms
            name="ThePhile"
            path="/"
            loginUrl="/Project/WebModules/Accounts/Login.aspx"
            protection="All"
            timeout="30">
        </forms>
    </authentication>

it has to be something with the upgrade to 2003 and 1.1 any help is mondo appretiated!!!
 
Old May 29th, 2005, 07:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you delete all your .dll and .pdb files when you upgraded the version? You need to start with a clean slate.

This will be difficult for you if you're not experienced with multiple-project solutions because the dependencies haven't been set up right to allow a clean compile the first time. This may take several hours to work through.

Eric
 
Old May 31st, 2005, 09:34 AM
Registered User
 
Join Date: Jul 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did delete the .pdb and .dll files from everywhere within the website (except for 3rd party dlls of course). I still have the problem but here is what i don't understand: I am authenticated on the login page and when i redirect im not authenticated but if i go back to the login page i now am authenticated and my "Authenticated User Panel" Shows up. So is it a problem with the sessionstate? It obviously reloads my login page and gives me the authenticated panel so that page knows im authenticated.

I've been using an implimentation of the phile in production for about 2 years (Thats why i havent bothered to upgrade) but i didn't realize the project dependancies where out of whack. What order should they be in and ill fix em. Thank you very much for your help Eric it seems your a power poster on this book!

 
Old June 1st, 2005, 01:50 PM
Registered User
 
Join Date: Jul 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Solved:

Added the following to my web.config inside the application
under system.web

  <machineKey validationKey="AutoGenerate"
            decryptionKey="AutoGenerate"
            validation="3DES"/>

I hate upgrades. Thanks for the help everyone.






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.