SORU
5 EYLÜL 2008, Cuma


Bütün bir site için https zorla ASP.NET en iyi yol?

Yaklaşık 6 ay önce her isteğin https üzerinden olması için gerekli bir site attım. Bir sayfaya her istek https olduğundan emin olmak için, bulabildiğim anda tek yolu sayfa load olayı kontrol edildi. Eğer istek http bitmiş olsaydı, değil yanıt istiyorum.("") https://mysite.com . yönlendirme

Daha iyi bir yolu ideal web içinde bazı ayar var.config?

CEVAP
5 EYLÜL 2008, Cuma


bunu buldum

ölü link -- kaldırıldı

temelde

protected void Application_BeginRequest(Object sender, EventArgs e)
{
   if (HttpContext.Current.Request.IsSecureConnection.Equals(false) && HttpContext.Current.Request.IsLocal.Equals(false))
   {
    Response.Redirect("https://"   Request.ServerVariables["HTTP_HOST"]
    HttpContext.Current.Request.RawUrl);
   }
}

bu küresel giderdim.asax.cs (veya küresel.asax.vb)

ben web içinde bunu belirtmek için bir yol biliyor.config

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • BiGSH0TROB

    BiGSH0TROB

    7 NİSAN 2011
  • Joseph Hayhoe

    Joseph Hayho

    20 Mayıs 2010
  • Need for Speed

    Need for Spe

    8 ŞUBAT 2006