Weird error related to User class

  • Thread starter Hans De Schrijver
  • Start date
H

Hans De Schrijver

I have an assembly with 2 projects. The first project (CLSLibrary) is a
Class Library that contains public class User. The second project
(CLSTester) is an ASP.NET Web Application that contains a Web Form
(CLSTestForm.aspx).
The code-behind file of the Web Form has reference to CLSLibrary and a
'using CLSLibrary' directive, so it can use the User class.

The CLSLibrary compiles without errors. However, running the CLSTestForm
generates the following
error message:
System.Security.Principal.IPrincipal' does not contain a definition for
'GetUser'.

(Note: the GetUser function is a public static function in the User class)

Here's the odd thing: if I change the class name from User to MyUser in
CLSLibrary, rebuild the class then run the aspx form, everything runs fine.

Is there a predefined User class in .NET that I don't know about? I also
can't find much info online about the "System.Security.Principal.IPrincipal'
does not contain a definition for " error. Any ideas what;s going on?

-- Hans De Schrijver
 
J

John

There's the Page.User property (public property of the page class), which is
an IPrincipal object that represents 'the user making the page request'.
Could that be it?

-John
 
H

Hans De Schrijver

Thanks a million, John!!!

That's it... I guess the only way to indicate that I want to use my own User
class is to explicitly declare every reference to User as CLSLibrary.User,
otherwise Page.User is implied. Or is there a way to turn off the Page.User?

-- Hans
 
J

John

Heh - no worries!

I'm a bit of a newb here, though, so I'm not so sure on how you would
disable Page.User or what the possible complications would be... I suppose
you could try to override the User property within the page, but I'm not
sure if that would work or be worthwhile- have to get some input from
someone who has a better idea of what they're doing. ;)

Anyway, good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top