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

  • ADDVOiCE

    ADDVOiCE

    28 Mayıs 2009
  • thenewboston

    thenewboston

    4 ŞUBAT 2008
  • wowchick16

    wowchick16

    17 Mart 2007