Access static property in Global.asax

B

Brian Vallelunga

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,079
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top