global.asax classname

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default global.asax classname

    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 Guest

  2. Similar Questions and Discussions

    1. Webservice and global.asax
      Hi, I have a webapplication with webservices. For the webapplication I'm using the global.asax file. Not for the webservices. When a user...
    2. global.asax
      Hi all! I've created a simple aspx application and when I run it locally on my pc all works fine. If I move it on the web server I get the...
    3. Global Error handling in Applicatio_Error() of Global.asax
      Hi all, For a web application if we are using web farm, and if i want to do Global Error handling can i use Applicatio_Error() method in...
    4. What is Global.asax?
      It's the class file definition code for the Session and Application events - if you have anything that should be done when a user first connects or...
    5. Global ASAX error
      Sounds like references have been removed from your web.config file. Look in your web.config file under...
  3. #2

    Default Re: global.asax classname

    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" <askme@fake.com> wrote in message
    news:O%23Besa8SDHA.1588@TK2MSFTNGP11.phx.gbl...
    > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139