issue with passing session value to stored procedure paramter RRS feed

  • Question

  • User1267402261 posted


    I have 2 pages one is aspx.cs and another is ashx page.

    In the very frist page i am getting userid from session and in ashx i am retreving it.like below

    aspx.cs page

    Session["UserID"] = UserID;

    In ashx page i have stored procedure where i am updating the records for this stored procedure i need to pass session value

    string sessionValue = context.Session["UserID"].ToString();

    here in sessionValue i will get id of the user.

    when comming to stored procedure method how can i get this value here in @lastupdatedby paramter?

    if (forms["oper"].ToString() == "edit")


    cmd.Parameters.AddWithValue("@lastupdatedby",--- );

    cmd.Parameters.AddWithValue("@AID", forms["SAID"].ToString());


    I tried creating a function but still not getting.


    string getsessiondata(HttpContext sessionValue)

    {string sessionValue1 = sessionValue.Session["UserID"].ToString();

    return sessionValue1;




    Any help.......

    Tuesday, December 2, 2014 3:22 PM