简体   繁体   中英

Opening web page programmatically

I am trying to launch chrome, directed at a web site that requires user credentials. I am trying to set up a program that can plug in user credentials automatically, but when I run this it opens the page but there is a black background with an unhappy face icon in the upper left. I am using C# to do this. At the bottom of this message is a code snippet of what I am doing:

    public void LaunchBrowser()
    {
        var startInfo = new ProcessStartInfo
                            {
                                FileName = SelectedBrowser.FilePath,
                                UserName = SelectedUser.UserName,
                                Password = SelectedUser.PasswordSecured,
                                Domain = "****.com",
                                Arguments = SelectedEnvironment.Server,
                                UseShellExecute = false,
                            };
        Process.Start(startInfo);
    }

Can you tell me why this is showing up dark (blank)? And do I need to change a configuration setting to allow a user name and password to be passed through to the page?

Thanks!

-Andrew

UserName and Password refer to Windows credentials that are used to launch the process; not HTTP credentials that are sent to the web server. You are unlikely to have much luck launching an external web browser and passing credentials in the HTTP headers. Some workarounds are in this question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM