有没有一种方法可以拦截WebBrowser对SSL的调用(在asp.net应用程序中)?在发出请求之前,我需要在运行时将参数传递给http-headers。
示例:如果我键入"http://test.com",浏览器将与服务器通信,并将"https://test1.com“作为安全的url返回。我应该能够拦截呼叫并将头信息(键,确定原始主机的值)传递给http://test.com。还是有更好的解决方案来实现这一点?
提前感谢
发布于 2009-07-13 21:56:13
我执行以下操作强制用户使用HTTPS:
protected override void OnPreInit(EventArgs e)
{
if (string.Compare(Request.ServerVariables["HTTPS"], "OFF", true) == 0)
{
StringBuilder builder = new StringBuilder("https://");
builder.Append(Request.ServerVariables["SERVER_NAME"]);
builder.Append(Request.ServerVariables["URL"]);
Response.Redirect(builder.ToString());
return;
}
base.OnPreInit(e);
}你应该能够修改它来做你需要做的事情。
https://stackoverflow.com/questions/830341
复制相似问题