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
Sourabh Dhiman
NA
323
58.8k
web api and jquery .
Jul 31 2019 3:30 AM
How to store session value into database use web api Controller and jquery.
This is my code. Any idea
[HttpPost]
public string Login(SessionModel model)
{
var session = HttpContext.Current.Session;
if (session != null)
{
if (session["username"] == null)
session["username"] = "post:" + DateTime.Now.ToString();
return "pass session: " + model.UserName + " --- " + session["username"].ToString();
}
else
{
return "session error!";
}
---
function PassModel() {
debugger;
var SessionModel = {
UserName: $('#username').val(),
User_Pwd: $('#Password').val()
}
$.ajax({
type: "Post",
url: 'http://localhost:4490/api/Login',
data: JSON.stringify(SessionModel),
contentType: 'application/json',
success: function (result) {
alert("session");
}
});
}
This is jquery code.
Reply
Answers (
2
)
How to return a link referencing to uploaded file?
Asp.net web api