Question Visual Studio and WebBrowser?

alex198555

Member
Joined
Dec 13, 2010
Messages
11
Programming Experience
Beginner
I had a problem with WebBrowser component. Basically, it works improperly when try to log in on one web-site (Forex Trading Social Network | Online Forex Trading Forum and Social Networking Site).

I am working with Visual Studio 2010 Professional. I created a simple WebBrowser trying to access the indicated web-site.

The problem begins. Well, the website loads, but when you go to the login page (Forex Trading Social Network | Online Forex Trading Forum and Social Networking Site) and try to log in, it doesn't work. I mean, when I enter the login details the login page just refreshes itself and the login wasn't proceed. The same login page appear with every login attempt. The is the current problem!

I check with Google, it works. But, it doesn't work with Forex Trading Social Network | Online Forex Trading Forum and Social Networking Site! Why?


Well, I tried to do it the same thing on Visual Studio 2008 at my University and it works.

Maybe, the operating system is the cause of it? I am using Windows Seven.

Or, I need to install additional components for Visual Studio in order to use https protocol.


Waiting for your help
 
What happens when you browse to the site with IE? Do you have the same problem? If so does clicking 'compatability view' resolve it?
 
Well, I don't know but the same thing or problems exists when I try to use IE?! Can WebBrowser act independently from IE? Or use Mozilla settings?! Mozilla works fine. Waiting for your reply?!
 
Do you have IE8 or IE9? Does it do the same thing with both IE x64 and IE x86? Does it work if you click the 'compatability view' icon

WebBrowser uses the client version of IE
 
I figure out the problem! The cookies were the main trouble. So, there is a new emerging questions. How can I tell VB to set the IE cookies to low, medium and high?!
 
As far as I know the only way is though JavaScript.

As an example I use this to delete the current cookie

VB.NET:
                Dim vWB As New WebBrowser
                vWB.Dock = DockStyle.Fill
                HOASiteTab.Controls.Add(vWB)
                vWB.Navigate(YourUrl)
                vWB.Navigate("javascript:void((function(){var a,b,c,e,f;f=0;a=document.cookie.split('; ');for(e=0;e<a.length&&a[e];e++){f++;for(b='.'+location.host;b;b=b.replace(/^(?:%5C.|[^%5C.]+)/,'')){for(c=location.pathname;c;c=c.replace(/.$/,'')){document.cookie=(a[e]+'; domain='+b+'; path='+c+'; expires='+new Date((new Date()).getTime()-1e11).toGMTString());}}}})())")
                vWB.Navigate(YourUrl)
 
I mean, can I place the button on the forms then indicate to which level to set the cookie?! In your case, you are setting the cookies to a certain URL. But, I meant to change the cookies in IE overall settings, not to open the IE. Just press the button and the cookies' setting in IE will be changed automatically, not calling IE to be opened. Is it possible?

Moreover, will this code work in Visual Studio? It seems like that it's the older versions of VB?
 
Do you mean cookies or IE security level? Did you resolve your problem by changing IE security levels (overall or for that site)?

Will what code work in VS? If you mean the sample I left - of course, I use VS2010.
 
Yes, I did resolve the problem by changing the IE's cookies to low level overall. It's wasn't set for a certain web-site. I will make a screenshot later, so you can see it. Sorry for that, I am at my University working on some project. So, do you have any idea how to do it?
 
Problem is you can't really 'hi-jack' a users security settings unless you start making changes to registry, and I for one would be miffed if someone did that to me! If you can make a secure connection (https) via SSL to the site you want to login to, then the best way would be to advise the user to add it to their trusted site list
 
Problem is you can't really 'hi-jack' a users security settings unless you start making changes to registry, and I for one would be miffed if someone did that to me! If you can make a secure connection (https) via SSL to the site you want to login to, then the best way would be to advise the user to add it to their trusted site list

You see I am a beginer. I would like to learn the Visual Studio in forums, because it's much better to learn by communicating with others. Can you post the code over here, how can I add the web-site to the trusted list? I will check it later at home, if you posted the one over here?!
 
security_001.jpg


security_002.jpg


security_003.jpg
 
Back
Top