Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old January 21st, 2004, 02:19 AM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Users and Authentication p. 179

When I use the code on p. 179:

 Wrox.WebModules.Accounts.Business.User currentUser = new Wrox.WebModules.Accounts.Business.User((Wrox.WebMo dules.Accounts.Business.PhilePrincipal)Context.Use r);

I get a message that says that the "Specified cast is not valid." What is the problem with this line of code?

Thanks!!!!

  #2 (permalink)  
Old February 4th, 2004, 08:54 AM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In my case, ther was 2 problems.

Case 1 :
When starting "myaccount.aspx" without login.aspx
there was no time to set
"Context.User = (PhilePrincipal)newUser"
that make the casting problem

Case 2 :
When copy the source code to the new file(Login.aspx of new project)
In the part of
"#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
initializeComponent();
}
private void InitializeComponent()
{
    this.Submit.Click += new System.EventHandler(this.Submit_Click);
    this.Load += new System.EventHandler(this.Page_Load);
}
#endregion"


The code
"
base.OnInit(e);
initializeComponent();
"
was changet to
"
initializeComponent();
base.OnInit(e);
" automatically.
I can't the reason
but after fixing it. There was no problem.
Try it.
  #3 (permalink)  
Old February 5th, 2004, 01:55 AM
Registered User
 
Join Date: Feb 2004
Location: Colombo, , Sri Lanka.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am also receiving the same error. I did what Jupiter has suggested but what I notice here is that my authentication mode changes to "Windows authentication mode".

Please Help !!
  #4 (permalink)  
Old June 28th, 2004, 01:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

It appears on subsequent requests that the reference to PhilePrincipal is lost (it's a reference to WindowsIdentity). Consider storing the object reference in Session or Cache.

Brian


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with authentication users hcusto BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 August 9th, 2006 02:32 PM
Authentication users hcusto ASP.NET 2.0 Basics 0 August 9th, 2006 04:44 AM
users and authentication raja_699 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 1st, 2005 07:04 PM
ModuleConfig Users and Authentication Chapter 5 seanmayhew BOOK: ASP.NET Website Programming Problem-Design-Solution 0 July 5th, 2004 10:49 AM





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