Goal
Using .NET Framework 4.0, prevent multiple requests for log-in credentials.
Setup
I have a Windows Form application that utilizes System.Net.HTTP.HttpClient to authenticate on another domain.
With basic authentication, I want to use those same credentials to open the default browser to a specific URL (same domain as above).
Tried
System.Diagnostics.Process.Start
System.Diagnostics.Process.Start(pathToDefaultBrowser, userName, passwordAsSecureString, URL)
Result
System.ComponentModel.Win32Exception was unhandled by user code
ErrorCode=-2147467259
HResult=-2147467259
Message=Logon failure: unknown user name or bad password
NativeErrorCode=1326
Source=System
StackTrace:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName, String userName, SecureString password, String domain)
Questions
- Is this possible?
- Is my implementation wrong?
- Is there a better way?