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
Mandar Shinde
NA
423
115.6k
Regarding HttpContext.Current.Session
Mar 20 2019 6:11 AM
Dear All,
I was developing simple login component using Anular 5 and ASP .Net MVC 5 with API Controller.
While creating that functionality I am facing one problem i.e. I am not able to get value of HttpContext.Session object in another component.
Here is my ApiController Code :-
public
class
LoginController : ApiController
{
private
ILoginRepository _loginRepository;
public
LoginController()
{
_loginRepository = UnityFactory.ResolveObject
();
}
public
HttpResponseMessage Post(string userName,string password)
{
string response = _loginRepository.Post(userName, password).ToString();
if
(response.Contains(
"302"
))
{
HttpContext.Current.Session.Add(
"UserName"
, userName);
string data = HttpContext.Current.Session[
"UserName"
].ToString();
}
return
Request.CreateResponse(_loginRepository.Post(userName,password));
}
}
Please help me in how to send session from ApiController To Angular 5 and vice versa.
Or you can suggest me another option to Session which will be accepted.
Thanking You In Advance.
Reply
Answers (
3
)
Copy and Paste to Web GridView
Angular ASP.NET