Re: How to change User Agent string frequently?



BOOL CWBHostView::OnAmbientProperty(COleControlSite* pSite,
DISPID dispid, VARIANT* pvar)
{
USES_CONVERSION;
// Change download properties - no java, no scripts...
if (dispid == DISPID_AMBIENT_DLCONTROL)
{
pvar->vt = VT_I4;
pvar->lVal = DLCTL_NO_SCRIPTS | DLCTL_NO_JAVA
| DLCTL_NO_RUNACTIVEXCTLS | DLCTL_NO_DLACTIVEXCTLS;

return TRUE;
}

// Change user agent for this web browser host during hyperlinks
if (dispid == DISPID_AMBIENT_USERAGENT)
{
CString strUserAgent("MyWebBrowserHost");

pvar->vt = VT_BSTR;
pvar->bstrVal = ::SysAllocString(T2OLE(strUserAgent));

return TRUE;
}

return CView::OnAmbientProperty(pSite, dispid, pvar);
}


--
Regards
Sheng Jiang

Microsoft Most Valuable Professional in Visual C++
http://www.jiangsheng.net
http://blog.joycode.com/jiangsheng/
<mladen074@xxxxxxxxx> ????
news:1161559670.287324.183070@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I'm using:
UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, UserAgent,
strlen(UserAgent), 0);
to set the User Agent string and it works. I'm simply using the
WebBrowser control to embed a little webbrowser functionality in my
app. but once I call UrlMkSetSessionOption() and change the user agent
string it cannot be changed with further calls :(

Can I anyhow change the user agent string multiple times?
Thanks in advance,
Mladen.



.



Relevant Pages

  • Re: Netsurf and User Agent faking
    ... NetSurf doesn't currently do this. ... the user agent string can only be changed at compile ... In some ways I would like not to use faking, ...
    (comp.sys.acorn.apps)
  • Re: Impersonate Login Page
    ... web site with what a web browser sends. ... than one site that checks the user agent string. ... recognize the user agent they'd simply return a 404 or a 500 code. ... IE request with the UserAgent property on HttpWebRequest. ...
    (microsoft.public.dotnet.framework.aspnet)
  • How to change User Agent string frequently?
    ... to set the User Agent string and it works. ... WebBrowser control to embed a little webbrowser functionality in my ... Can I anyhow change the user agent string multiple times? ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Send out different content depends on User Agent String
    ... > Is there an easy way in PHP which send outs different content ... > depends on User Agent String value? ... This is a string denoting the user agent being ... Prev by Date: ...
    (comp.lang.php)
  • Re: Inconsistent result from urllib.urlopen
    ... The scripts I wrote like this worked fine for a while ... and then stopped working within the past couple of weeks. ... Maybe it has to do something with your user agent string. ... The server side can decide to return a different content when your user agent is not 'mozilla', ...
    (comp.lang.python)