简体   繁体   English

以编程方式打开网页

[英]Opening web page programmatically

I am trying to launch chrome, directed at a web site that requires user credentials. 我正在尝试针对需要用户凭据的网站启动chrome。 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. 我正在使用C#来做到这一点。 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; UserNamePassword是指用于启动该过程的Windows凭据。 not HTTP credentials that are sent to the web server. 而不是发送到Web服务器的HTTP凭据。 You are unlikely to have much luck launching an external web browser and passing credentials in the HTTP headers. 启动外部Web浏览器并在HTTP标头中传递凭据的可能性不大。 Some workarounds are in this question . 此问题中有一些解决方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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