• 1397/12/08

ریدارکت httpبه https در asp core :

سلام. استاد چجوری مشه تو asp core 

http به https ریدایرکت کرد

ممنون

  • 1397/12/09
  • ساعت 09:12

سلام 

   // IHostingEnvironment (stored in _env) is injected into the Startup class.
        if (!_hostingEnvironment.IsDevelopment())
        {
            services.Configure<MvcOptions>(options =>
            {
                options.Filters.Add(new RequireHttpsAttribute());
            });
        }

 


  • 1397/12/09
  • ساعت 09:13
        if (env.IsDevelopment())
        {
            app.UseBrowserLink();
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");

            // todo: replace with app.UseHsts(); once the feature will be stable
            app.UseRewriter(new RewriteOptions().AddRedirectToHttps(StatusCodes.Status301MovedPermanently, 443));
        }

 


logo-enamadlogo-samandehi