Coffeehouse Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

HttpWebRequest header control

Back to Forum: Coffeehouse
  • User profile image

    I have used Fiddler...

    to discover the soap request I need to post and I want to use the HttpWebRequest to make the post.

    It has headers that are not properties of the httpwebrequest class.

    Accept: */*
    Referer: http://wpdwwa00/crn/pat/rsapp.htm
    Content-Type: text/xml; charset=utf-8
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; SALT 1.0.5507.1 0111 Developer; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.40607)
    Host: wpdwwa00
    Cookie: cc_session=home:w|tabs:|view:l|s_cc:|s_conf:na|s_sch:td|s_serv:na|s_disp:na|s_set:|s_dep:na|s_dir:na|s_sms:dd|s_ct:sa|lines:15|cols:3|ls:|refresh:30|e_hp:CAMID(*22WPCDWA01*3au*3aauthid*3d431146513*22)|e_proot:Public*20Folders|e_mroot:My*20Folders|e_user:Geoff*20Switz|ucap:armqm|ui:|e_root:|write:true; cam_passport=101:08b50b8e-937a-23e9-20e7-22cb2a357680:0112182037; CRN=contentLocale%3Den-us%26productLocale%3Den%26format%3D%26timeZoneID%3DAmerica%252FNew_York%26; AS_TICKET=1124796644sPvb6QGF
    Proxy-Connection: Keep-Alive
    Pragma: no-cache
    Accept-Language: en-us
    Content-Length: 18711

    How can I add these headers to my request?



  • User profile image

    This topic belongs in the Techoff forum.

  • User profile image

    ZippyV wrote:
    This topic belongs in the Techoff forum.

    but just to be helpful.

    The HttpWebRequest has a Headers collection, to which you can add custom headers. Note that you can't set some the headers which are exposed as specific properties of the Request object, like UserAgent, ContentLength and so on.

  • User profile image
    Sven Groot

    You don't need to set most of those headers. Host and contentlength are set automatically. Authentication is done using the HttpWebRequest.Credentials member. UserAgent is fairly inconsequential (although I've seen web sites that didn't work if it wasn't sent at all).

    So what you actually need to set is the soapaction, and for that you can use the Headers collection.

    A question though: why are you not using the built-in Web Services functionality of .Net?

  • User profile image

    I'm not using the built in functionality in .net b/c the service is hidden. I can't reference the service b/c the service cannot be discovered. We have purchased a product from Cognos that is kind of buggy. Our drill thru reports fail on occasion until we open and resave the report. This resave action is this soap request I'm working on, but they want me to do it manually, using a web browser that uses ActiveX controls to submit this soap request. So, I've used fiddler to discover the soap request so that I can submit it automatically. The Object explorer does not say you can set the headers, it only says you can get them (but this is at the HttpWebRequest level). At the WebRequest level, you can both get and set them. I didn't see this at first.

    Since this post doesn't belong here, is it possible to delete it all together. I will not post this type of post to this forum again.



Conversation locked

This conversation has been locked by the site admins. No new comments can be made.