Assembly question

  • Thread starter Hans De Schrijver
  • Start date
H

Hans De Schrijver

First off, I'm pretty new to web development with C# and ASP.NET.
With that said, I've been scratching my head for the past 2 hours, trying to
figure out the following problem:

I created a first project (CLSLibrary) with one class (user.cs), defined as
"public class User". This class contains some public methods and properties
as well as some public static methods. This class lives in CLSLibrary
namespace and builds correctly into CLSLibrary.dll.
Subsequently, I created a second project (Tester) within the same solution.
This project contains one Web Form (CLSTester.aspx) and the corresponding
CLSTester.aspx.cs file.
In the second project I added a reference to CLSLibrary.

Now here's the problem: When I try to run CLSTester.aspx I receive the
following error:
*** System.Web.UI.Page.User' denotes a 'property' where a 'class' was
expected. ***
The line that causes the error reads:
User u = User.GetUser(1);

The GetUser() function is a static function of the User class and returns a
User object. I did notice that the IntelliSense on the User object u doesn't
reveal any properties or methods of the User class but rather just the
default object properties and methods.

Note: The User class was initially developed and tested as part of a Web
Form where both the test Class and the User class lived in the same aspx
file. The user class worked perfect that way. Only now by trying to separate
UI from CLS library am I not getting the aspx file to recognize the User
class.

Could anyone shed some light on this? I suppose it's a trivial matter, but
being a newby I'm just not seeing it...

-- Hans De Schrijver
 
J

Josh

From the message, it looks like your User Class still thinks its derived
from a web page. Ive just tried a similar thing here without a problem! So
your principal seems fine.
 
H

Hans De Schrijver

My User class states:
public class User : System.ComponentModel.Component

This was automatically generated by VS.NET when I created the Component
Class.
Any other thoughts?

-- Hans
 
H

Hans De Schrijver

Meanwhile I have gotten a bit further... the using directive was missing for
CLSLibrary (which contains the User class).

However, when I compile the CLSLibrary now, I keep getting the following
error message:
System.Security.Principal.IPrincipal' does not contain a definition for
'GetUser'.

I found out that 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 User predefined class in .NET that I don't know about? I'm
lost... please help.

-- Hans De Schrijver
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top