System.__ComObject is not what I want returned

Discussion in 'ASP .Net' started by les, May 30, 2007.

  1. les

    les Guest

    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")?
    les, May 30, 2007
    #1
    1. Advertising

  2. les

    Patrice Guest

    I made a test in classic ASP and was it returns actually an IStringList
    object. So try perhaps ServerVariables["SomeVar"].Item(1).ToString().

    --
    Patrice

    "les" <> a écrit dans le message de news:
    ...
    >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")?
    >
    Patrice, May 30, 2007
    #2
    1. Advertising

  3. les

    les Guest

    On May 30, 5:30 pm, "Patrice" <http://www.chez.com/scribe/> wrote:
    > I made a test in classic ASP and was it returns actually an IStringList
    > object. So try perhaps ServerVariables["SomeVar"].Item(1).ToString().
    >
    > --
    > Patrice
    >
    > "les" <> a écrit dans le message de news:
    > ...
    >
    >
    >
    > >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"].ToStr­ing().Trim();

    >
    > > strRequest += "\t" + address_remote;
    > > strRequest += "\t" +
    > > System.Web.HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"].ToStr­ing();
    > > }
    > > 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")?- Hide quoted text -

    >
    > - Show quoted text -


    Thank you very much! What I actually works now is just slightly
    different,

    strRequest = ((IStringList)oRequest.ServerVariables["SCRIPT_NAME"])
    [1].ToString();

    which I found on
    http://www.velocityreviews.com/foru...ic-asp-not-aspnet-objects-from-net-class.html
    with a search inspired by your post. Thanks again

    Les
    les, Jun 1, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mminto
    Replies:
    0
    Views:
    9,865
    mminto
    Jan 20, 2006
  2. ben
    Replies:
    4
    Views:
    4,218
    Richard A. Michaels
    Dec 19, 2003
  3. hazz
    Replies:
    2
    Views:
    602
  4. Replies:
    4
    Views:
    148
    Ted Zlatanov
    Sep 13, 2006
  5. pavi
    Replies:
    0
    Views:
    1,331
Loading...

Share This Page