Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • sahadev 18 posts 145 karma points
    Feb 15, 2017 @ 11:01
    sahadev
    0

    Session Issue in Surface Controller and Class File

    Hello,

    when i tried to set value in session its give me error " object not set instance of reference "

    This is my code , when i call this methods it's give me above error

    public ActionResult TestSesion()
    {
        try
        {
            Session["test"] = "test";
            string sessionValue = Session["test"].ToString();
        }
        catch (Exception ex)
        {
    
            throw ex;
        }
    
        return null;
    }
    

    but if i m set session value in .cshtml page its working perfectly ,

    please help me solve this issue as soon as possible

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies