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

  • ELPRESADOR

    ELPRESADOR

    21 HAZİRAN 2008
  • Jonathan Leack

    Jonathan Lea

    26 ŞUBAT 2007
  • Paulo Bautista

    Paulo Bautis

    21 Aralık 2008