Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 15th, 2004, 01:09 PM
Registered User
 
Join Date: Mar 2004
Location: OKC, OK, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Dave0865
Default CType Issues

Venturing late into the .NET world, I appreciate the book and its insights and examples. However, I am having difficulty with the Page Load Event of MyAccount.aspx.

The line:

Dim currentUser As New AccBusiness.User( _
                   CType(Context.User, SitePrincipal))

Gives me the dreaded "Specified Cast is not valid" error.

The application is configured for FORM validation.

The SitePrincipal class Implements System.Security.Principal.IPrincipal

I have modified the original code to use my own database. The Login routine works fine. As well as the cookie for revisiting the site. It is only in trying to load the data for the edit page that i get an error.

Anyone have a clear understanding of why it is happening?

Or at least a definitive work-around?


Thanks in advance


Dave Haunschild
  #2 (permalink)  
Old March 17th, 2004, 12:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is a common issue. Did you read the .doc file included with the VB.NET source code?
  #3 (permalink)  
Old March 22nd, 2004, 09:09 PM
Authorized User
 
Join Date: Mar 2004
Location: Benicia, CA, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Someone please explain this further. I have read the text document which came with the code download and I can not for the life of me, figure out why I am getting the cast error for my CType(context.User, SitePrincipal). It seems as though on rare occassions it is actually working for me. isauthenticated is working very consistently, but I can not figure why TypeOf Context.User Is SitePrincipal does not seem to be true. What have I missed, screwed up, or not configured. Please, I don't have that much more hair to loose.

  #4 (permalink)  
Old March 23rd, 2004, 12:50 PM
Authorized User
 
Join Date: Mar 2004
Location: Benicia, CA, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I finally found the posts concerning Visual Studio regenerating code. After stripping the handles.. from my sub page_load, the code appears to work much better.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
connection string issues, web.config file issues kaliaparijat ASP.NET 2.0 Professional 1 June 12th, 2008 08:07 AM
VB Ch11 Using Profiles p415 - CType Rich57 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 June 12th, 2008 05:58 AM
Return CType(Me.GetPropertyValue("Cult thuyvncr BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 16th, 2006 11:26 AM
CType string To Byte sirmilt BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 March 2nd, 2006 09:06 PM
CType (When is it useful?) LULU VB.NET 9 October 7th, 2003 10:43 PM



All times are GMT -4. The time now is 01:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.