L
les
I have a c# class that I want to work, when compiled into a dll,
either in asp.net or classic asp 3.0. It references
System.EnterpriseServices and ASPTypeLibrary and as far as the dll
used either an asp.net page or an asp page goes, it functions, apart
from the following part which is meant to gather, for logging,
request.servervariable objects When called by an asp page they return
the string System.__ComObject instead of an i.p. address or part of a
url.
This is the code:
if(System.Web.HttpContext.Current != null)
{
//the calling page is aspx
string address_remote =
System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString().Trim();
strRequest += "\t" + address_remote;
strRequest += "\t" +
System.Web.HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"].ToString();
}
else
{
// the calling page is classic asp
ASPTypeLibrary.Request oRequest =
(ASPTypeLibrary.Request)ContextUtil.GetNamedProperty("Request");
if(oRequest as ASPTypeLibrary.Request == null)
{
//this never gets executed, so oRequest is not null
strRequest += "xxx.xxx.xxx.xxx";
strRequest += "\t/path1/path2/dummy.asp";
}
else
{
//the next two become "System.__ComObject"
string address_remote =
oRequest.ServerVariables["REMOTE_ADDR"].ToString();
strRequest += "\t" + address_remote;
strRequest += "\t" +
oRequest.ServerVariables["SCRIPT_NAME"].ToString();
}
}
How can I get the actual values of what would in classic asp be
Request.ServerVariables("REMOTE_ADDR") and
Request.ServerVariables("SCRIPT_NAME")?
either in asp.net or classic asp 3.0. It references
System.EnterpriseServices and ASPTypeLibrary and as far as the dll
used either an asp.net page or an asp page goes, it functions, apart
from the following part which is meant to gather, for logging,
request.servervariable objects When called by an asp page they return
the string System.__ComObject instead of an i.p. address or part of a
url.
This is the code:
if(System.Web.HttpContext.Current != null)
{
//the calling page is aspx
string address_remote =
System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString().Trim();
strRequest += "\t" + address_remote;
strRequest += "\t" +
System.Web.HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"].ToString();
}
else
{
// the calling page is classic asp
ASPTypeLibrary.Request oRequest =
(ASPTypeLibrary.Request)ContextUtil.GetNamedProperty("Request");
if(oRequest as ASPTypeLibrary.Request == null)
{
//this never gets executed, so oRequest is not null
strRequest += "xxx.xxx.xxx.xxx";
strRequest += "\t/path1/path2/dummy.asp";
}
else
{
//the next two become "System.__ComObject"
string address_remote =
oRequest.ServerVariables["REMOTE_ADDR"].ToString();
strRequest += "\t" + address_remote;
strRequest += "\t" +
oRequest.ServerVariables["SCRIPT_NAME"].ToString();
}
}
How can I get the actual values of what would in classic asp be
Request.ServerVariables("REMOTE_ADDR") and
Request.ServerVariables("SCRIPT_NAME")?