p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

aspdotnet_website_programming thread: Specified cast is not valid


Message #1 by "Marco Garibaldi" <admin@i...> on Fri, 10 May 2002 11:23:06 +0200
At page 176 of the book there is an explanation on how to modify the
SiteHeader control to add user authentication to every page. The part of
code I have problems with is the following (amended):

	SiteIdentity id =3D (SiteIdentity)Context.User.Identity;

As I work with VB.NET I translated the above code into the following

	Dim currentUser As SiteIdentity =3D CType(Context.User.Identity,
SiteIdentity)


When I test the page I get this error:

	System.InvalidCastException: Specified cast is not valid.


I use Option Strict On on the page. I tried with Option Strict Off but I
still get the error.

Does anyone know how I can resolve this problem?

* Marco

  Return to Index