Feedback

Permanent Redirect

Sprache: C#

Mit folgenden Code bekommt man einen 302 Redirect (Moved Temporarily): [code]var response = base.Context.Response; response.Redirect("http://dotnet-snippets.de", false);[/code] In vielen Fällen möchte man jedoch eine Dauerhafte Weiterleitung umsetzen. Hier muss eine andere Funktion aufgerufen werden wie man in dem kleinen Snippet sehen kann:
protected void Page_Load(object sender, EventArgs e)
{
// Response holen
var response = base.Context.Response;
            
// Permanent Umleiten
         response.RedirectPermanent("http://dotnet-snippets.de", false);

}
protected void Page_Load(object sender, EventArgs e)
{
// Response holen
var response = base.Context.Response;
            
// Permanent Umleiten
         response.RedirectPermanent("http://dotnet-snippets.de", false);

}