G
Guest
Hi guys
I'm trying to implement an external class (.cs) for popping a window and
doing various bits and peices. I want to pass to the overloaded constructor a
reference to the page that called the class, so that the class can add some
javascript to the page.
Here's my globals and constructor...
public string e;
public System.Web.UI.Page _sender;
public ACR(string e, System.Web.UI.Page sender)
{
_errorcode = e;
_sender = sender;
DoACR();
}
here's the code for the DoACR() function...
public void DoACR()
{
string cs;
cs = "<script language=\"Javascript\">\n";
cs += "window.open('acr.aspx?c=" + _errorcode + "&p=" +
_sender.Request.ServerVariables["HTTP_URL"].ToString() + "', '_blank',
'width=" +
ConfigurationSettings.AppSettings.Get("System_ReportBug_WindowWidth") + ",
height=" +
ConfigurationSettings.AppSettings.Get("System_ReportBug_WindowHeight") +
",channelmode=0,directories=0,fullscreen=0,location=0,resizable=0,scrollbars=0,status=0,toolbar=0');";
cs += "window.close();\n";
cs += "</script>";
if(!_sender.IsStartupScriptRegistered("close"))
_sender.RegisterStartupScript("close", cs);
}
and from my Page_Load of my page, I'm calling it thus...
ACR crash = new ACR("0x00", this);
I'm getting a "object reference not set to an object" error on the line in
DoACR() that calls _server.Request.ServerVariables["HTTP_URL"].ToString();
How is that happening? As I'm callling my class from Page_Load, I assume
that "this" has been defined as the Page?
Any thoughts appreciated...
Cheers
Dan
I'm trying to implement an external class (.cs) for popping a window and
doing various bits and peices. I want to pass to the overloaded constructor a
reference to the page that called the class, so that the class can add some
javascript to the page.
Here's my globals and constructor...
public string e;
public System.Web.UI.Page _sender;
public ACR(string e, System.Web.UI.Page sender)
{
_errorcode = e;
_sender = sender;
DoACR();
}
here's the code for the DoACR() function...
public void DoACR()
{
string cs;
cs = "<script language=\"Javascript\">\n";
cs += "window.open('acr.aspx?c=" + _errorcode + "&p=" +
_sender.Request.ServerVariables["HTTP_URL"].ToString() + "', '_blank',
'width=" +
ConfigurationSettings.AppSettings.Get("System_ReportBug_WindowWidth") + ",
height=" +
ConfigurationSettings.AppSettings.Get("System_ReportBug_WindowHeight") +
",channelmode=0,directories=0,fullscreen=0,location=0,resizable=0,scrollbars=0,status=0,toolbar=0');";
cs += "window.close();\n";
cs += "</script>";
if(!_sender.IsStartupScriptRegistered("close"))
_sender.RegisterStartupScript("close", cs);
}
and from my Page_Load of my page, I'm calling it thus...
ACR crash = new ACR("0x00", this);
I'm getting a "object reference not set to an object" error on the line in
DoACR() that calls _server.Request.ServerVariables["HTTP_URL"].ToString();
How is that happening? As I'm callling my class from Page_Load, I assume
that "this" has been defined as the Page?
Any thoughts appreciated...
Cheers
Dan