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

  • Animation Workshop

    Animation Wo

    8 NİSAN 2010
  • LevelUpTuts

    LevelUpTuts

    20 Ocak 2012
  • The Exploiteers

    The Exploite

    4 Ocak 2011