global.asax classname

Discussion in 'ASP .Net' started by noname, Jul 16, 2003.

  1. noname

    noname Guest

    i have the following in global.asax:
    <%@ Application Codebehind="Global.asax.cs" Inherits="Foo.Global"
    Classname="AppClass" %>

    but wherever i use AppClass.foo() i get the compiler error:
    The type or namespace name 'AppClass' could not be found (are you missing a
    using directive or an assembly reference?)

    am i missing something?
    thanks.
    noname, Jul 16, 2003
    #1
    1. Advertising

  2. noname

    Graham Guest

    This is my guess (* guessing is required without knowing more about your
    global.asax.cs implementation).

    When you create a Global.asax file with code behind you are actually
    defining what will be a super class of the actual runtime class ASP.NET
    uses. This is the same as what happens when you are dealing with aspx
    files.

    For example:

    By default the code behind class for Global.asax is called "Global". It is
    a subclass of HttpApplication. Your definition of global.asax will probably
    cause ASP.NET to create a new class called AppClass that is a subclass of
    Global. Like this:

    HttpApplication
    +-- Global
    +-- AppClass

    I have a bit of a problem with your Application directive though because the
    Framework 1.1 documentation I have doesn't have a Classname attribute.
    Assuming that is not your problem your problem probably has to do with your
    use of the class AppClass. How exactly are you refering to it? Do you have
    all your code in the code behind of the class Global? You probably should
    have. It is difficult to know what your problem is exactly without knowing
    a bit more.

    Generally though, the class Global, which by default is the subclass of
    HttpApplication that you can use to implement your subclass behaviour is
    where you should be doing all your overriding of HttpApplication methods and
    adding your own methods and properties. You probably shouldn't be calling
    AppClass.foo() either because it doesn't exist or is not visible to the
    caller.

    My comments probably aren't very helpful but I'm sure the solution would be
    clear if you could provide a bit more detail ...

    Graham.

    "noname" <> wrote in message
    news:O%...
    > i have the following in global.asax:
    > <%@ Application Codebehind="Global.asax.cs" Inherits="Foo.Global"
    > Classname="AppClass" %>
    >
    > but wherever i use AppClass.foo() i get the compiler error:
    > The type or namespace name 'AppClass' could not be found (are you missing

    a
    > using directive or an assembly reference?)
    >
    > am i missing something?
    > thanks.
    >
    >
    Graham, Jul 16, 2003
    #2
    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. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    804
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  2. Oliver S.

    classname::classname a type ?

    Oliver S., Sep 11, 2003, in forum: C++
    Replies:
    1
    Views:
    494
    White Wolf
    Sep 11, 2003
  3. Hongzheng Wang
    Replies:
    32
    Views:
    859
  4. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,142
    Mark Rae
    May 23, 2006
  5. Ante Perkovic

    CSS: "tagname.classname" or ".classname"

    Ante Perkovic, Dec 22, 2003, in forum: Javascript
    Replies:
    2
    Views:
    98
Loading...

Share This Page