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

  • hockeywebcasts

    hockeywebcas

    31 EKİM 2012
  • Tire Rack

    Tire Rack

    31 Mayıs 2007
  • Videojug

    Videojug

    25 EKİM 2006