Assembly question

Discussion in 'ASP .Net' started by Hans De Schrijver, Jun 4, 2004.

  1. 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
     
    Hans De Schrijver, Jun 4, 2004
    #1
    1. Advertising

  2. Hans De Schrijver

    Josh Guest

    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.
     
    Josh, Jun 4, 2004
    #2
    1. Advertising

  3. 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

    "Josh" <> wrote in message
    news:%...
    > 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.
    >
    >
     
    Hans De Schrijver, Jun 4, 2004
    #3
  4. 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



    "Hans De Schrijver" <> wrote in message
    news:z8Vvc.42465$...
    > 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
    >
    >
    >
     
    Hans De Schrijver, Jun 4, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Prasanna Padmanabhan
    Replies:
    1
    Views:
    838
    Mattias Sjögren
    Nov 19, 2003
  2. Brent
    Replies:
    1
    Views:
    1,392
    Brent
    Jan 23, 2004
  3. SA
    Replies:
    0
    Views:
    493
  4. Horatiu Margavan via .NET 247

    Assembly's manifest definition does not match the assembly reference.

    Horatiu Margavan via .NET 247, Aug 30, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,661
    Horatiu Margavan via .NET 247
    Aug 30, 2004
  5. Grant Merwitz
    Replies:
    3
    Views:
    9,112
    Grant Merwitz
    Sep 15, 2005
Loading...

Share This Page