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
Harish Batchu
NA
255
70.2k
I need to create session inside of the webmethod?
Oct 25 2018 5:32 AM
I have one method inside class in that class i have one webmethod there i need to create session variable
public partial class Incomeexpenses : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod (EnableSession =true)]
[ScriptMethod]
public static string SaveDetails(string Name, string Password)
{
Util u = new Util();
try
{
string ip = u.GetIP();
SqlCommand cmd;
SqlConnection con = new SqlConnection();
SqlDataReader dr;
con = u.GetConnection();
cmd = new SqlCommand("select User_Uniq from Dim_Users where User_Email='" + Name + "'", con);
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
//here i need to create session variable
Session["UserName"] = dr.GetString(0).ToString();
con.Close();
return "true";
}
else
{
con.Close();
return "false";
}
}
catch (Exception ex)
{
throw ex;
}
}
}
Reply
Answers (
2
)
SSO angular and asp.net
:: Barcode Reader reload Page ::