4

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 ?

dr. evil
  • 26,944
  • 33
  • 131
  • 201

1 Answers1

1

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

Stobor
  • 44,246
  • 6
  • 66
  • 69
  • This is VB.NET I'm trying accessing document.domain property. It's OK to read but I can't overwrite it. – dr. evil Jan 05 '09 at 09:03
  • 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 Jan 05 '09 at 22:59
  • 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 Jan 05 '09 at 23:07