By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

global.asax classname

P: n/a
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.
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <as***@fake.com> wrote in message
news:O%****************@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.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.