public static string ChangeUriToHttps(HttpRequest request)
{
string uri = request.Url.AbsoluteUri;
if (!IsRequestSecure(request))
uri.Replace("http", "https");
return uri;
}
如果我发送的请求中包含这样的uri:
http://localhost/AppName/somepage.aspx
它不会用https替换http。
答案 0 :(得分:17)
public static string ChangeUriToHttps(HttpRequest request)
{
string uri = request.Url.AbsoluteUri;
if (!IsRequestSecure(request))
uri = uri.Replace("http", "https");
return uri;
}