Question

I have a winform app that requires me to check whether a page exists on our Wiki or not. However, that query requires a users NetWork credentials to be passed.

I don't want to hardcode my credentials, and I don't want users to have to manipulate the App.config everytime someone else uses it (there's also the issue of them having to expose their password in the App.Config). Is there a way I can get the current user's NT credentials? I don't need to see it (that would be an obvious security issue), I just need it for the following line of code:

HttpWebRequest WikiPageRequest;
WikiPageRequest.Credentials = new NetworkCredential("user", "pass", "dom");
//maybe do something like this
WikiPageRequest.Credentials = GetNTCredentials();
Was it helpful?

Solution

Can you try using CredentialCache.DefaultCredential? That seems to get you the current logged in users credential.

OTHER TIPS

If by "wiki", you mean a deployment of MediaWiki, then sadly you need user id and password.

Unfortunately you cannot get it from Windows, because, even the Windows OS itself does not know the password. It just stores a hash of the password.

By the way, why dont you ask for user id/password for wiki each time the user starts the app?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top