asp.net-core-mvc

How can I share session among subdomains in ASP.NET Core?

痞子三分冷 提交于 2021-02-04 15:07:53
问题 I have a website which has subdomains such as ali.sarahah.com but if a user logs in from www.sarahah.com then goes to ali.sarahah.com the session is not saved. After searching I added the following in Startup.cs : app.UseCookieAuthentication(new CookieAuthenticationOptions { CookieDomain = ".sarahah.com" }); I found out that .AspNetCore.Identity.Application cookie domain is still showing the subdomain and not the the domain and that session problem is still there. Am I doing something wrong?

How can I share session among subdomains in ASP.NET Core?

廉价感情. 提交于 2021-02-04 15:06:44
问题 I have a website which has subdomains such as ali.sarahah.com but if a user logs in from www.sarahah.com then goes to ali.sarahah.com the session is not saved. After searching I added the following in Startup.cs : app.UseCookieAuthentication(new CookieAuthenticationOptions { CookieDomain = ".sarahah.com" }); I found out that .AspNetCore.Identity.Application cookie domain is still showing the subdomain and not the the domain and that session problem is still there. Am I doing something wrong?

How can I share session among subdomains in ASP.NET Core?

◇◆丶佛笑我妖孽 提交于 2021-02-04 15:05:52
问题 I have a website which has subdomains such as ali.sarahah.com but if a user logs in from www.sarahah.com then goes to ali.sarahah.com the session is not saved. After searching I added the following in Startup.cs : app.UseCookieAuthentication(new CookieAuthenticationOptions { CookieDomain = ".sarahah.com" }); I found out that .AspNetCore.Identity.Application cookie domain is still showing the subdomain and not the the domain and that session problem is still there. Am I doing something wrong?

404 with static content in Razor Class Library (RCL)

*爱你&永不变心* 提交于 2021-02-04 14:15:23
问题 I am having difficulties implementing static files in razor class library (.net Core 3.1) that are consumed by an ASP.NET Core (v3.1) application. When trying to access the static files, I only get an 404 - Not Found. I followed the following answer on Stackoverflow: https://stackoverflow.com/a/57874357/1099519 or I also cross-checked with the documentation at: https://docs.microsoft.com/en-us/aspnet/core/razor-pages/ui-class?view=aspnetcore-3.0&tabs=visual-studio#create-an-rcl-with-static

ASP.NET Core 3.1 - Failed to load resource: the server responded with a status of 404 ()

╄→尐↘猪︶ㄣ 提交于 2021-01-29 22:46:40
问题 I'm trying to load a resource file from the /wwwroot/3d_models folder location. In the Startup.cs I enabled app.UseStaticFiles(); and added the following snippet: app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider(Path.Combine(env.WebRootPath, @"3d_models")), RequestPath = new AspNetCore.Http.PathString("/models") }); app.UseDirectoryBrowser(new DirectoryBrowserOptions() { FileProvider = new PhysicalFileProvider(Path.Combine(env.WebRootPath, @"3d_models")),

Multiple routes to the same razor page

穿精又带淫゛_ 提交于 2021-01-29 22:32:58
问题 Background I've got a razor page in my Asp.Net Core 3.1 website called SignupAndApply. It's effectively a copy and paste of the register identity page but: With some additional fields Allows an optional applyid to be passed as part of the route If I pass an applyId as part of the route, I make a couple of label changes to the page and redirect the user somewhere else I want to create two routes for this page: /identity/account/signupandapply/{applyId?} 'when the user is applying and signing

Multiple routes to the same razor page

别等时光非礼了梦想. 提交于 2021-01-29 19:35:01
问题 Background I've got a razor page in my Asp.Net Core 3.1 website called SignupAndApply. It's effectively a copy and paste of the register identity page but: With some additional fields Allows an optional applyid to be passed as part of the route If I pass an applyId as part of the route, I make a couple of label changes to the page and redirect the user somewhere else I want to create two routes for this page: /identity/account/signupandapply/{applyId?} 'when the user is applying and signing

Automatic login using jwt in Cookie in ASP.net MVC Core

陌路散爱 提交于 2021-01-29 15:03:55
问题 My process flow is : User logs into a Issuer Application (Username/Password) Clicks a link of the Client Application that they want to goto Issuer Application creates a jwt and stores it in a Cookie Issuer Application does a Response.Redirect to Client Application Client Application authenticates user using the jwt in the Cookie and creates the Principal and automatically logs in user. Below is my Client Application setting from the Startup ConfigureServices method: var key = new

How can I send the messages to specific user using user's id which stored in Mssql database?

荒凉一梦 提交于 2021-01-29 11:13:34
问题 I want to implement private chat system with Mssql Database.I want to one to one chat system. One user enter the receiver id which stored in database and message text, then send the message to Receiver . Then the message appears in receiver message area which has that receiver id. In my code works like this; Signalr produce connection id but this id changes every refresh, I want to constant id. How can I do This? This is my js code "use strict"; $(document).ready(() => { var connection = new

ASP.Net Core: keep windows authentication

。_饼干妹妹 提交于 2021-01-29 11:01:40
问题 I'm actually working on an website where users login via windows authentication. My problem is, that actually all users have to login whenever they open our webpage. I wonder if it is possible to keep that windows authentification alive? Maybe with cookies? I implemented the authentification by adding this to my Startup.cs : services.Configure<IISOptions>(options => { options.AutomaticAuthentication = true; }); services.AddAuthentication(IISDefaults.AuthenticationScheme); And activating