asp.net 2.0驗證網址如果是http就導到https , 使用C#
protected void Page_Load(object sender, EventArgs e)
{
//如果是http就導到https,
if (Request.ServerVariables["HTTPS"].ToString() == "off")
{
Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri.Replace("http:", "https:"));
}
}
protected void Page_Load(object sender, EventArgs e)
{
//如果是https就導到http
if (Request.ServerVariables["HTTPS"].ToString() == "on")
{
Response.Redirect(HttpContexurrent.Request.Url.AbsoluteUri.Replace("https:", "http:"));
}
}
2007年8月31日 星期五
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言