c# - reusable "save credentials" dialog (like IE's or Vista's) in .NET or Win32 -


Recently I am working in an office with a wireless network that uses an annoying authentication scheme: Every few hours, you can open a browser and type the username / password in the authentication web page, or you lose network access (when the time is over, your next browser request will redirect to the request page, And if your credit If you have already passed, you will be redirected to the page you were originally trying to get).

This kind of annoyance may be okay for an airport or coffee shop, but it is becoming unconscious in an office - especially if you work with network services (eg SVN, email) , Who suddenly stop working for a few hours, browser.

So I have written a small #console app that will login to me by sending me an HTTP request to the login form with my credentials.

This is clearly unsafe - everyone is sitting inside my source code to see my password. I am able to save my credentials using the same mechanism, which IE uses, for example, to save passwords and fill in the web form.

Ideally, I want to add credentials (including an optional "saved credits" checkbox with an optional "saved credits" checkbox) to enter, save, and retrieve an optional usable component so that my app is Something could do in Pseudocode):

  // Retrieve any saved credentials from some secure location credentials creds = GetCreds (some parameters go here); // If no one is archived, show the user "Enter and optionally save credentials" dialog if (CRS == empty) creds = GetCredsDialog (some parameters go here); // if on the post authentication page (creds! = Null) {string authUrl = "https: // somehost / login /"; String postDataPattern = "post data pattern here"; // use the string instead here? String postData = string.format (postDataPattern, HttpUtility.HtmlEncode (creds.Username), HttpUtility.HtmlEncode (creds.Password)); Webclient wc = new webclient (); String html = wc.UploadString (authUrl, "POST", postData); // TODO: If HTML login fails, explicitly stored credentials // indicates and asks for new credit. Try again}  

Actually I want to change the load of the stock safely from my app to Windows, under the assumption that Windows users will be better than this. )

I'm not looking for iron-worn protection here, just to secure my other stored passwords for some other websites, which is comparable to IE. I do not want to have plain text passwords in my code!

Of course, here is the right solution to work with the IT department to get the real certification plan for the wireless department, but in the meanwhile I am on my own

A .NET solution It would be better, but a Win32 solution would also be fine - I could just close the app without causing much trouble to the app.

To store credentials, use the class in System.Security.dll. By passing, no other user will be able to decrypt the data.

Edit : For the dialog, you can use the API function

Look for the .Net wrapper.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -