views:

1506

answers:

1

How can I set current document.domain in WebBrowser Control to avoid "Access is denied" in Cross-domain calls (XMLHTTP Requests or Iframe/frame access)?

I've tried

CurrentDocument = WebBrowserControl.Document
CurrentDocument.domain = "example.com"
Console.writeline("xx" & CurrentDocument.domain)

This doesn't work, somehow it never reaches console.writeline

Am I doing something wrong? Or should I use WebBrowserControl.ActiveXInstance ?

+1  A: 

What language are you writing this in? Are you accessing the property .Domain or the non-existant property .domain?

Stobor
This is VB.NET I'm trying accessing document.domain property. It's OK to read but I can't overwrite it.
dr. evil
Hmm - I'm testing your code in a simple VB.net application, and I get an ArgumentException thrown on the second line. Are you also getting an exception?(Also, if I use CurrentDocument.domain, VS2008 corrects it to CurrentDocument.Domain. I can't find any reference to a lowercase .domain property.)
Stobor
Stobor thanks for answer (it's VB.NET so not case-sensitive, sry for the example). Now I isolate the project and also I'm getting ArgumenException. Basically it doesn't accept anything but the correct domain, so I'm stuck!
dr. evil