converting HTTPWebResponse object to HTTPResponse object

Discussion in 'ASP .Net' started by deepak, Feb 14, 2008.

  1. deepak

    deepak Guest

    Hi All,

    I have a httpwebresponse object(given below)

    Dim req As WebRequest
    Dim rsp As WebResponse

    <....logic to read the http web request object.....>
    rsp = req.GetResponse()


    i want to convert in(or read in into) into exsiting httprequest object (say
    named as 'Response')


    How this can be done..?Any helo would be great for me..

    Thanks,
    Deepak
    deepak, Feb 14, 2008
    #1
    1. Advertising

  2. "deepak" <> wrote in message
    news:...
    > Hi All,
    >
    > I have a httpwebresponse object(given below)
    >
    > Dim req As WebRequest
    > Dim rsp As WebResponse
    >
    > <....logic to read the http web request object.....>
    > rsp = req.GetResponse()
    >
    >
    > i want to convert in(or read in into) into exsiting httprequest object

    (say
    > named as 'Response')
    >
    >
    > How this can be done..?Any helo would be great for me..
    >


    Umm I think what you want is:-

    Dim rsp As HttpWebResponse

    .. . .

    rsp = DirectCast(req.GetResponse(), HttpWebResponse);

    This is client-side code. You use HttpWebRequest to send stuff and
    HttpWebResponse to receive stuff. This is the client end of the HTTP
    conversation.

    The HttpRequest and HttpResponse objects are serverside objects, you use
    HttpRequest to receive stuff and HttpResponse to send stuff. This is the
    Server end of the HTTP conversation.

    HttpResponse and HttpWebResponse types are entirely different classes
    existing in different namespaces.

    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Feb 14, 2008
    #2
    1. Advertising

  3. deepak

    deepak Guest

    Hi Anthony,

    Thanks, it was really helpful.Anothnay i have one more question which i
    rsaied seperately to read the nodes which has date(s) or you ca say have a
    fixed format (date format) and i need to conver those date(S) to utc while
    seding to client side..May you have a look on that one also please...It would
    be great help for me...really....

    -Deepak

    "Anthony Jones" wrote:

    > "deepak" <> wrote in message
    > news:...
    > > Hi All,
    > >
    > > I have a httpwebresponse object(given below)
    > >
    > > Dim req As WebRequest
    > > Dim rsp As WebResponse
    > >
    > > <....logic to read the http web request object.....>
    > > rsp = req.GetResponse()
    > >
    > >
    > > i want to convert in(or read in into) into exsiting httprequest object

    > (say
    > > named as 'Response')
    > >
    > >
    > > How this can be done..?Any helo would be great for me..
    > >

    >
    > Umm I think what you want is:-
    >
    > Dim rsp As HttpWebResponse
    >
    > .. . .
    >
    > rsp = DirectCast(req.GetResponse(), HttpWebResponse);
    >
    > This is client-side code. You use HttpWebRequest to send stuff and
    > HttpWebResponse to receive stuff. This is the client end of the HTTP
    > conversation.
    >
    > The HttpRequest and HttpResponse objects are serverside objects, you use
    > HttpRequest to receive stuff and HttpResponse to send stuff. This is the
    > Server end of the HTTP conversation.
    >
    > HttpResponse and HttpWebResponse types are entirely different classes
    > existing in different namespaces.
    >
    > --
    > Anthony Jones - MVP ASP/ASP.NET
    >
    >
    >
    deepak, Feb 14, 2008
    #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. Satinderpal Singh

    HttpWebResponse/HttpWebRequest problem...

    Satinderpal Singh, Jun 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,787
    Satinderpal Singh
    Jun 4, 2004
  2. Karsten Grombach

    Session Cookie and HttpWebResponse

    Karsten Grombach, Jul 23, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    3,647
    Karsten Grombach
    Jul 23, 2003
  3. Robert Hanson
    Replies:
    4
    Views:
    8,521
    Yan-Hong Huang[MSFT]
    Aug 1, 2003
  4. Sean Chapman

    HttpWebResponse Problems

    Sean Chapman, Oct 25, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    7,494
    Sean Chapman
    Oct 27, 2003
  5. MrJun
    Replies:
    1
    Views:
    445
    gerry
    Dec 18, 2003
Loading...

Share This Page