-
-
Save polatengin/db8f5c184e3c555e0c3401a9bc6506fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Asp.Net Core web uygulamalarinda HTTPS adreslere yönlendirme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Configure(IApplicationBuilder app) | |
{ | |
app.UseRewriter(new RewriteOptions().AddRedirectToHttps()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ConfigureServices içerisinde GlobalFilters listesine eklenebilir | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.Configure<MvcOptions>(options => | |
{ | |
options.Filters.Add(new RequireHttpsAttribute()); | |
}); | |
} | |
// Controller sınıfı üzerinden eklenebilir | |
[RequireHttps] | |
public class HomeController : Controller | |
{ | |
// Action method üzerinden eklenebilir | |
[RequireHttps] | |
public IActionResult Index() | |
{ | |
return View(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment