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 July 31st, 2003, 10:39 AM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please Help with Context.User Issue

After successfull validation on my Login.aspx page I execute the following code:-

PayDayLoan.WebModules.Accounts.Business.PhilePrinc ipal newUser = PayDayLoan.WebModules.Accounts.Business.PhilePrinc ipal.ValidateLogin( SSN.Text.Trim(), Password.Text.Trim() );
Context.User = newUser;
FormsAuthentication.SetAuthCookie( SSN.Text, true );

In my Web.Config file I have following configuration :-

<authentication mode="Forms">
    <forms name="PayDayLoanWebsite" path="/"
      loginUrl="/PayDayLoanWebsite/Modules/Accounts/Login/Login.aspx"
      protection="All" timeout="30">
   </forms>
 </authentication>

But when I go to the next page, MyAccount.aspx, the Context.User.GetType() returns me "System.Security.Principal.GenericPrincipal" in my application where as in ThePhile it returns "Wrox.WebModules.Accounts.Business.PhilePrincipal" ; which is what I want, I think I should get "PayDayLoan.WebModules.Accounts.Business.PhilePrin cipal"; which I am not. Somehow I am loosing the context between the pages.

Please help me with this problem.

Thank you.

Niketu


 
Old June 28th, 2004, 01:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

I'm having the same problem too, it's not carrying the object reference for some reason. If you don't find a solution, consider using the Cache or Session to maintain the object reference.

Brian
 
Old June 28th, 2004, 08:29 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brian,

I haven't seen this problem myself.

I agree that putting it in session state is a good idea, but I wouldn't put an individual user's security context in the cache because it's not fundamentally isolated. It's not good to depend on home-grown source code to keep the users separated (might work good, but seems like a security risk).

Did you see my posting here - is this how you set up your page:
http://p2p.wrox.com/topic.asp?TOPIC_ID=15318

I'm debating going to a simpler model based on Generic Principal instead of a custom Principal. Have you considered this? The Microsoft TimeTracker Starter Kit has a good, and simple, implementation of Generic Principal.

Eric





Similar Threads
Thread Thread Starter Forum Replies Last Post
Context.User.Identity.Name jimbeam36 BOOK: ASP.NET Website Programming Problem-Design-Solution 4 November 6th, 2004 06:33 AM
(SitePrincipal)Context.User Philey BOOK: ASP.NET Website Programming Problem-Design-Solution 3 October 8th, 2004 05:38 PM
Context User davidroth BOOK: ASP.NET Website Programming Problem-Design-Solution 0 April 14th, 2004 12:49 AM
Maintaining Context.User cjh301 BOOK: ASP.NET Website Programming Problem-Design-Solution 6 March 30th, 2004 04:50 AM





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