我需要在win form web browser c#application中存储或记住我选择的用户名和密码字段值,就像任何其他流行的Web浏览器一样。 例如:在winforms浏览器中,它始终显示没有任何记忆值。 Stack Overflow login options
但我需要存储用户名和密码值。喜欢 Stack Overflow in firefox
我是这样做的
public partial class Form1 : Form{
private readonly string WebPage = "http://example.com";
public Form1()
{
InitializeComponent();
Navigation_func(WebPage);
}
private void Navigation_func(string address)
{
//check if the address is blank or null
if (string.IsNullOrEmpty(address))
return;
//check if the page is blank
if (address.Equals("about:blank"))
return;
//check if the page is start with http or https or file
if (!address.StartsWith("http://") && !address.StartsWith("https://") && !address.StartsWith("file:/"))
{
address = "http://" + address;
}
try
{
//Actual Navigation
//webBrowser1.Navigate(new Uri(address));
webBrowser1.Navigate(address);
}
catch (UriFormatException)
{
}
}
}