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
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