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 March 15th, 2004, 01:09 PM
Registered User
 
Join Date: Mar 2004
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
 
Old March 17th, 2004, 12:55 AM
Friend of Wrox
 
Join Date: Jun 2003
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?
 
Old March 22nd, 2004, 09:09 PM
Authorized User
 
Join Date: Mar 2004
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.

 
Old March 23rd, 2004, 12:50 PM
Authorized User
 
Join Date: Mar 2004
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.






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





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