0
두 개의 서버가 있다고 가정 해보십시오. 하나는 https 인증서로 실행하고 다른 하나는 실행하지 않습니다. 내 사이트 중 하나를 방문하는 사용자가 http를 입력합니다. https 인증서가있는 서버를 가리키는 사이트가 사용자를 리디렉션하고 URL을 다시 쓰려고합니다.https 인증서로 실행중인 IIS에서 사이트를 확인하는 방법
남아있는 것은 하나뿐입니다. 내 사이트에 인증서가 있는지 어떻게 확인합니까? 또는 바인딩이 https이면?
void Application_BeginRequest(object sender, EventArgs e)
{
var path = HttpContext.Current.Request.Url.AbsolutePath;
var variableToSeeIfIISSiteRunningOnCertificate = true;
if (variableToSeeIfIISSiteRunningOnCertificate && !HttpContext.Current.Request.IsSecureConnection && !string.IsNullOrEmpty(path) && path.ToLower().Contains("loginpage.aspx"))
{
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri.Replace("http://", "https://"));
}
}