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 June 18th, 2004, 09:43 AM
Registered User
 
Join Date: Jun 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Still the error

I am still getting the "Specified Cast is not valid" error for SiteIdentity in SiteHeader.ascx.vb.
I have built the solution by copying and modifying the code one file at a time. But the code
is 100% identical (except for namespaces).

I have modified the events for all pages (Default, Login, MyAccount) that inherit from PhilePage like this:
Code:
        Protected Overrides Sub OnInit(ByVal e As EventArgs)
            MyBase.OnInit(e)
            InitializeComponent()
        End Sub

        'This call is required by the Web Form Designer.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            AddHandler Me.Load, AddressOf Page_Load
        End Sub

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
            'Removed "Handles MyBase.Load"
        End Sub
I have not made that change in the code for SiteHeader. I am now using this fix:
Code:
                If Not (TypeOf context.User Is SitePrincipal) Then
                    id = New SiteIdentity(Context.User.Identity.Name)
                Else
                    id = CType(context.User.Identity, SiteIdentity)
                End If
Which seems to work, but I want to know why it isn't working (very frustrating because the
code is the same, and the Wrox.ThePhile solution is working, but mine isn't) and also
how to fix?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
[Resolved] Error calling a sp - parameter error snufse .NET Framework 2.0 2 February 12th, 2008 04:46 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
Phile Page error, visual studio error reps BOOK: ASP.NET Website Programming Problem-Design-Solution 0 September 27th, 2003 10:11 AM





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