Monday, August 16, 2010

Cisco wireless web authentication , web form auto login, java htmlunit, webbrowser control

In .NET world, If you want to invoke web pages, fill out forms, click links, etc..., you can writing logic target the WebBrowser Class.

for example, you need to enter username/password everytime when you access some wireless network which is secured by Cisco Wireless web authentication.

you can write a Simple C# application to parse the Dom, get the input fields and assign the value, then invoke the click event on the submit button. here is one sample C# Code.

if you have the problem on MAC, you can’t use the .NET for sure.
I am always looking for the same web Brower control , unfortunately, there is NO webbrwser control which works like the C# one. However, you can use the HTMLUnit

with HtmlUnit, you can write a 10 tines of code to loadup one URL, fillout some forms, and submit.
here is one sample java code

4 comments:

Anonymous said...

How does one implement this handy workaround?

Thanks :)

Anonymous said...

I've put the C# code and Java code in the blog.

for c#, just create a new .net fx 3.5 wpf application, add one browser control.

then paste the code in my blog.

for java, just regular console app, reference the jar i mentationed.

Anonymous said...

Hi,

I have tried your code. It works perfectly with HTTP. However, it does not work with HTTPS?

Any suggestions?

androidyou said...

for the HTTPS , the only difference is the certificate used by the device. always the certificate is not trusted by default.

you can explicitily trust all certificate or just add the cert to the trusted list.

here are some reference in C#

http://msdn.microsoft.com/en-us/library/system.net.icertificatepolicy.aspx

 
Locations of visitors to this page