Comments (10)
Could you share a sample repro project?
from session.
thanks for reply i am following this https://github.com/aspnet/MusicStore
this is the code where session is created
private static string GetCartId(HttpContext context)
{
var cartId = context.Session.GetString("Session");
if (cartId == null)
{
//A GUID to hold the cartId.
cartId = Guid.NewGuid().ToString();
// Send cart Id as a cookie to the client.
context.Session.SetString("Session", cartId);
}
return cartId;
}
but tis not working on CORS i am getting cookie in response header but its not set in browser .
everytime it just send me new set cookie in response header , the cookie is never set ,it may be stupid to ask but i am not sure, is it cors related or i have add any cookiedomain or something so it can work with any domain... I am also using angular2 as client
from session.
What is your CORS policy? Some CORS policies do not allow cookies.
from session.
@Tratcher as for now i have allowed everything in CORS , anyways after researching a lot i found cookies wont work on cross domain for security reasons. anyways i will get the app on subdomain , will test and close the issue
from session.
well its not working on subdomains either this is the response header
Set-Cookie:.mysession.Session=e506554c-34b1-8990-de71-a9d12cd4a3ff; domain=.mydomain.com; path=/; httponly
my session config
services.AddSession(options =>
{
options.CookieName = ".mysession.Session";
options.IdleTimeout = TimeSpan.FromSeconds(20);
options.CookieDomain = ".mydomain.com";
});
my CORS policy
services.AddCors(options =>
{
options.AddPolicy("AllowndSTFU",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowCredentials()
.AllowAnyHeader());
});
its generating cookie from backend.mydomain.com and i need to access it on app.mydomain.com
from session.
(not directly related, but it looks like you're still using RC2, you should move to 1.0).
from session.
This issue was moved to aspnet/CORS#81
from session.
not working even after updating...
from session.
@devilsuraj Can you be more specific?
from session.
@davidfowl i have a frontend app (angular2) hosted on app.mydomain.com i am making xhr calls to back.mydomain.com where .net backend app is hosted so when i need to maintain session between users and backend i am using code mentioned in my previous comments . it works if app and backend are both on same server but with CORS i.e. in my case on different domain it fails to create session cookie . its there in response header but not being created so i am not able to maintain session so my app is not working . hope it explains....
It should work if i mention the domain name option of session ... but now this issue has been moved to CORS . howver no one is responding there :(
from session.
Related Issues (20)
- Remove obsolete options APIs HOT 3
- Update session to configure DistributedMemoryCache options by default HOT 3
- Add logging scope for session HOT 2
- Random "Accessing expired session" warning HOT 4
- Error closing the session with .net 2.1.0-preview1 HOT 12
- Any plans for maximum session size property? HOT 2
- [1.1.4] Flaky test: SessionTests.SessionLogsCacheRefreshException HOT 6
- System.OperationCanceledException at Microsoft.Extensions.Caching.Redis.RedisCache+<RefreshAsync>d__25.MoveNext HOT 4
- cant access Session in other API HOT 5
- Error closing the session HOT 1
- [Patch 2.0.x] Downgrade cancellation logs HOT 1
- Add EventSource/EventCounter tracing and metrics for Session HOT 1
- Session does not work with Redis when the client has HTTP keep-alives disabled HOT 6
- Session cannot be re-loaded HOT 8
- Determine if the session cookie is considered essential HOT 1
- THIS ISSUE TRACKER IS CLOSED - use the Home repo issue tracker
- Session OnStart and Session OnEnd HOT 8
- How to get number of session HOT 3
- Re-initialize Session middleware from controller HOT 2
- How to add a custom session in .net core? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from session.