473,395 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Modify Request Header

I have a VB app hosting the Webbrowser control. I would like to add
"something" to the requests that app is submitted to our web application to
indicate that its from this webbrowser and not a separate instance of IE.

Is this possible, keeping in mind that I cannot add anything to the
registry, since a user may still use IE to visit the web app.
Dec 11 '05 #1
6 6072
Dave,

It is different for the axWebBrowser 1.x than for the WebBrowser 2.0.
Basicly it is setting using the interface the designmode to on and off.

This for the webbrowser 2.0

DirectCast(WebBrowser1.Document.DomDocument,
mshtml.IHTMLDocument2).designMode = "On"

Be aware that it has some strange side effects.

I hope this helps,

Cor

"Dave Slinn" <Co********@noemail.noemail> schreef in bericht
news:e5**************@TK2MSFTNGP12.phx.gbl...
I have a VB app hosting the Webbrowser control. I would like to add
"something" to the requests that app is submitted to our web application to
indicate that its from this webbrowser and not a separate instance of IE.

Is this possible, keeping in mind that I cannot add anything to the
registry, since a user may still use IE to visit the web app.

Dec 11 '05 #2
Hi Dave,

Welcome to MSDN newsgroup.
As for the modifying request header question you mentioned, based on my
research, the IE WebBrowser control's Navigate2 method can help specify our
custom http headers when we want to navigate to a certain web document. e.g:

private void btnNavigate_Click(object sender, System.EventArgs e)
{
object obj = null;
object url = txtUrl.Text;
object headers = "aaa:aaavalue\r\nbbb:bbbvalue";//"Accept-Language:
en-us,zh-cn,fr-FR,de-DE;q=0.5";

axWB.Navigate2(ref url, ref obj, ref obj, ref obj,ref headers);
}
Also, the IWebBrowser control also has the "BeforeNavigate2" event which
fires before navigate to a certain document, however, based on my testing,
we could only get the custom headers we specify in Navigate2 method there,
we can not reassign or modify the headers there. Regarding on this event,
I'll do some further research to see whether it is the by design behavior
or anything else to workaround it. (I test use the activeX control rather
than the .net 2.0's managed webbrowser control....)

I'll update you when I get some further information...

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "Dave Slinn" <Co********@noemail.noemail>
| Subject: Modify Request Header
| Date: Sat, 10 Dec 2005 23:15:57 -0600
| Lines: 8
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| X-RFC2646: Format=Flowed; Original
| Message-ID: <e5**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups:
microsoft.public.dotnet.framework.aspnet,microsoft .public.dotnet.framework.w
indowsforms.controls,microsoft.public.dotnet.gener al,microsoft.public.dotnet
..languages.vb,microsoft.public.dotnet.languages.v b.controls,microsoft.public
..inetsdk.programming.w
| NNTP-Posting-Host: mail.gms.ca 142.165.52.112
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.windowsforms.con trols:26017
microsoft.public.dotnet.general:184249
microsoft.public.dotnet.languages.vb:308070
microsoft.public.dotnet.languages.vb.controls:8487
microsoft.public.dotnet.framework.aspnet:364071
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| I have a VB app hosting the Webbrowser control. I would like to add
| "something" to the requests that app is submitted to our web application
to
| indicate that its from this webbrowser and not a separate instance of IE.
|
| Is this possible, keeping in mind that I cannot add anything to the
| registry, since a user may still use IE to visit the web app.
|
|
|

Dec 12 '05 #3
Hey Dave,

I've got confirmed with our IE guys about the IE WebBrowser control's
BeforeNavigation2 event, the Headers parameter in this event is actually
marked as [in] parameter from COM perspective, so this is read only .... So
far we're limited to use the Navigate or Navigate2 method to make http
request with our custom configured http headers....

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| X-Tomcat-ID: 164402880
| References: <e5**************@TK2MSFTNGP12.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 12 Dec 2005 10:18:40 GMT
| Subject: RE: Modify Request Header
| X-Tomcat-NG: microsoft.public.dotnet.general
| Message-ID: <Ab**************@TK2MSFTNGXA02.phx.gbl>
| Newsgroups: microsoft.public.dotnet.general
| Lines: 72
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.general:184289
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Dave,
|
| Welcome to MSDN newsgroup.
| As for the modifying request header question you mentioned, based on my
| research, the IE WebBrowser control's Navigate2 method can help specify
our
| custom http headers when we want to navigate to a certain web document.
e.g:
|
| private void btnNavigate_Click(object sender, System.EventArgs e)
| {
| object obj = null;
| object url = txtUrl.Text;
| object headers = "aaa:aaavalue\r\nbbb:bbbvalue";//"Accept-Language:
| en-us,zh-cn,fr-FR,de-DE;q=0.5";
|
| axWB.Navigate2(ref url, ref obj, ref obj, ref obj,ref headers);
| }
|
|
| Also, the IWebBrowser control also has the "BeforeNavigate2" event which
| fires before navigate to a certain document, however, based on my
testing,
| we could only get the custom headers we specify in Navigate2 method
there,
| we can not reassign or modify the headers there. Regarding on this
event,
| I'll do some further research to see whether it is the by design behavior
| or anything else to workaround it. (I test use the activeX control
rather
| than the .net 2.0's managed webbrowser control....)
|
| I'll update you when I get some further information...
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
| --------------------
| | From: "Dave Slinn" <Co********@noemail.noemail>
| | Subject: Modify Request Header
| | Date: Sat, 10 Dec 2005 23:15:57 -0600
| | Lines: 8
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| | X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <e5**************@TK2MSFTNGP12.phx.gbl>
| | Newsgroups:
|
microsoft.public.dotnet.framework.aspnet,microsoft .public.dotnet.framework.w
|
indowsforms.controls,microsoft.public.dotnet.gener al,microsoft.public.dotnet
|
.languages.vb,microsoft.public.dotnet.languages.vb .controls,microsoft.public
| .inetsdk.programming.w
| | NNTP-Posting-Host: mail.gms.ca 142.165.52.112
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.windowsforms.con trols:26017
| microsoft.public.dotnet.general:184249
| microsoft.public.dotnet.languages.vb:308070
| microsoft.public.dotnet.languages.vb.controls:8487
| microsoft.public.dotnet.framework.aspnet:364071
| | X-Tomcat-NG: microsoft.public.dotnet.general
| |
| | I have a VB app hosting the Webbrowser control. I would like to add
| | "something" to the requests that app is submitted to our web
application
| to
| | indicate that its from this webbrowser and not a separate instance of
IE.
| |
| | Is this possible, keeping in mind that I cannot add anything to the
| | registry, since a user may still use IE to visit the web app.
| |
| |
| |
|
|

Dec 13 '05 #4
Steven,

In my idea is it possible to reach the headers as I wrote, although not with
MSHTML because they are located outside the DOM area.

Not checked.

Cor
Dec 13 '05 #5
doh,

I thought that I had done something like this somewhere.

I copied the document as a textfile and than I could write it to disk
withouth that confirmation that is needed with the normal exec. I think that
you can use this as well to change the header.

However it is a while ago that I did this.

Cor
Dec 13 '05 #6
Thanks for your input Cor,

Yes, I admit that webbrowser control or MSHTML interface is not the proper
one to do http message customzing, I'd rather prefer the HttpWebRequest.
However, it seems that user interactive is the most important part in
Dave's scenario.....

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Cor Ligthert [MVP]" <no************@planet.nl>
| References: <e5**************@TK2MSFTNGP12.phx.gbl>
<Ab**************@TK2MSFTNGXA02.phx.gbl>
<bz*************@TK2MSFTNGXA02.phx.gbl>
<O1**************@TK2MSFTNGP11.phx.gbl>
| Subject: Re: Modify Request Header
| Date: Tue, 13 Dec 2005 09:24:29 +0100
| Lines: 13
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Response
| Message-ID: <Og*************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: ip3e830773.speed.planet.nl 62.131.7.115
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.general:184366
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| doh,
|
| I thought that I had done something like this somewhere.
|
| I copied the document as a textfile and than I could write it to disk
| withouth that confirmation that is needed with the normal exec. I think
that
| you can use this as well to change the header.
|
| However it is a while ago that I did this.
|
| Cor
|
|
|

Dec 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: patrice | last post by:
Is it possible to modify the Request-Line of an HTTP response ? I'd like to remove the parameters from a GET url. More precisely, I wish I could replace : with : The "Header" function...
8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
3
by: Marc Gingras | last post by:
Hi, I tried to modify the request object when my aspx page is loaded(or before). When I try to do it a received a "Read only" error message. Is it possible to modify a Request when the server...
6
by: utnemisis51 | last post by:
Hi, I'm trying to include some user credentials for accessing a remote webservice. The remote location requires that I use Basic authentication, which means, from browsing around, I need to...
1
by: ABCL | last post by:
Hi all I am develoing Asp.net application, but want to make it secure.. Is there anyway that I can Modify/Remove Request Header which contains some User related data? Thanks In Advanace Thanks...
31
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current browser window?...
5
by: dabei | last post by:
Hi, I am trying to use AS3 to make a URL request with authorization header. Using the code below: var request:URLRequest = new URLRequest ( 'http://myserviceURL' ); var...
2
by: =?Utf-8?B?d2FsdGVy?= | last post by:
Hi there... we have a list of internal websites. For logging purpose, we would like to attach some client side info in each HTTP request before submit to server. Two options for us : 1) each...
4
by: JRough | last post by:
I have this section at the end of a page ------------------- if ($_POST== 'Open in Excel'){ if (empty($data)) { $data = "\n(0) Records Found!\n";} header("Content-type:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.