TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Atul Srivastava
NA
68
850
XSRF Token not generating in Production Server using IIS 10
Jun 9 2019 10:41 AM
When running .Net Core Web API in local environment and Angular 5, XSRF token response cookies is getting generated but when deploy to production server, response cookies are not generated.
I have implemented CORS policy , web api and angular app are running in different domain and port and everything is working fine in dev environment but when deploy to production environment response cookies are not getting created.
I am using below code in Startup.cs
app.Use(async (context, next) =>
{
string
path1 = context.Request.Path.Value;
if
(path1 !=
null
&& path1.Contains(
"menu"
))
{
///// XSRF-TOKEN used by angular in the $http if provided
var tokens = antiforgery.GetAndStoreTokens(context);
context.Response.Cookies.Append(
"XSRF-TOKEN"
,
tokens.RequestToken,
new
CookieOptions()
{
Path =
"/"
,
HttpOnly =
false
,
Expires = DateTime.Now.AddMonths(1),
}
);
}
await next();
});
Please help me. Its urgent and not able to figure out what I am doing wrong.
I am running application using angular cli - ng serve and in production environment I am using IIS 10 and windows 2016 server.
Reply
Answers (
0
)
How we use signal R for any simple chat application.
How to use treeView to save the directory tree in the SQL ?