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 November 19th, 2003, 07:07 AM
Registered User
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Interface IPrincipal Problem

Iam not good at English ,sorry ,but I need help urgently!Thank you!

In Book < ASP.NET Website Programming: Problem - Design - Solution, C# Edition >

The author give a method to implement the Interface IPrincipal.
Then I try to create a class named 'NetPrincipal' implementing this Interface(IPrincipal).In my program,there are some codes like following: context.User=netPrincipal1 //this can run
                      //netPrincipal1 is a instance of NetPrincipal
           //but when change to another page
NetPrincipal n=(NetPrincipal)Contex.User// this can not run
          // error: invalidcasting!

How to solve this problem.

Old December 1st, 2003, 06:44 PM
Registered User
Join Date: Dec 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ton_isaac Send a message via Yahoo to ton_isaac

Should be...

IPrincipal n = HttpContext.Current.User;

Response.Write( "Authenticated Identity is: " + ((NetPrincipal)n).Identity.Name );
Good Luck! ;)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem With RSA Interface Floetic Java GUI 1 March 25th, 2008 06:14 AM
Problem With Implementing an Interface brettk_1 General .NET 1 February 28th, 2007 11:47 AM
n-tier interface problem rodmcleay General .NET 6 January 3rd, 2007 04:37 PM
QueryInterface for interface failed problem Birendra ASP.NET 1.x and 2.0 Application Design 1 December 16th, 2005 02:49 PM
Interface IPrincipal nightsun VS.NET 2002/2003 0 November 18th, 2003 07:39 AM

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