Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 506487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:42:23+00:00 2026-05-13T06:42:23+00:00

Lately I’ve been working in an office with a wireless network which uses an

  • 0

Lately I’ve been working in an office with a wireless network which uses an annoying authentication scheme: every few hours, you need to open up a browser and type a username/password into an authentication web page, or you lose network access. (When the time expires, your next browser request will redirect to the auth page, and if your creds pass muster, then you’ll be redirected back to the page you were trying to get to originally).

This kind of annoyance may be OK for an airport or coffee shop wireless, but in an office it’s infuriating– especially if you’re working with network services (e.g. SVN, email) which suddenly stop working every few hours unless you bring up a browser.

So I have written a tiny C# console app which will log in for me by sending an HTTP request to the login form with my credentials.

This is obviously insecure– my password is sitting inside my source code for all to see. I’d prefer to be able to save my credentials using the same mechanism that IE, for example, uses to save and re-fill passwords in web forms.

Ideally, I’d like a re-usable component for entering, saving, and retrieving credentials(including the UI with an optional “save creds” checkbox) so that my app can simply do something like this (in pseudocode):

// retrieve any saved credentials from some secure place
Credentials creds = GetCreds(some parameters go here);

// if none stored, then show the user an "enter and optionally save credentials" dialog
if (creds == null)
    creds = GetCredsDialog(some parameters go here);

// POST to the authentication page
if (creds != null)
{
    string authUrl = "https://somehost/login/";
    string postDataPattern = "post data pattern here";

    // use SecureString here instead?
    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 indicates login failure, clear stored credentials 
    // and ask for new creds. then retry.
}

Essentially I want to shift the burden of securely storing creds from my app to Windows, under the assumption that the Windows guys will be better at this than I will be. 🙂

I’m not looking for iron-clad security here, just something comparable to what IE is using to secure my other stored passwords for other websites. I just don’t want to keep plain text passwords in my code!

Of course, the right solution here is to work with the IT department to get them to get a real authentication scheme for Wireless, but in the meantime I’m on my own.

A .NET solution would be preferable, but a Win32 solution would be OK too– I could simply port the app to C++ without much trouble.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:42:23+00:00Added an answer on May 13, 2026 at 6:42 am

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

    EDIT: For the dialog, you can use the CredUIPromptForCredentials API function

    See here for a .Net wrapper.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 256k
  • Answers 256k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Using the Surround plugin for Vim, you can eliminate surrounding… May 13, 2026 at 10:37 am
  • Editorial Team
    Editorial Team added an answer Well,,,,,, problem now solved. Nothing to do with MVC. Nothing… May 13, 2026 at 10:37 am
  • Editorial Team
    Editorial Team added an answer The following is how I would do it. I have… May 13, 2026 at 10:37 am

Related Questions

Lately I had to change some code on older systems where not all of
Lately I've be moving source files around in our source tree. For example placing
Lately I've been in the habit of assigning integer values to constants and simply
Lately I've been using XPathDocument and XNavigator to parse an XML file for a
Lately I have seen a lot of blog posts concerning how to build loosely

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.