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

Access static property in Global.asax

P: n/a
I'm having trouble accessing a static property in my Global.asax file
from an HttpHandler (ashx). I have code that looks like this in my
Global.asax file:

<%@ Application ClassName="Global" %>
<script language="C#" runat="server">

public static string MyProperty
{
get { return "Hello"; }
}

</script>
It's pretty straightforward. Now, in my ashx file, I have the following:
<%@ WebHandler Language="C#" class="MyHandler" %>

public class MyHandler: IHttpHandler
{

public void ProcessRequest(HttpContext context)
{
string text = Global.MyProperty; // doesn't work
}
}

The problem is that Global.MyProperty can't be found. I am able to
access Global.MyProperty just fine from normal aspx pages, but not in
this case. Does someone know the answer to this?

Thanks,
Brian
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.