title: how to retrieve values from Session object in mvc3?
body: <p>I have mvc 3 application in which in session object I'm taking all values that is needed to me as parameter to execute stored procedure.</p>
  
  <p>If the userAction is update then execute stored procedure.</p>
  
  <pre><code>public ActionResult Index(string userAction) 
  { 
     if(Session["Mappings"] != null)            
          ViewData["Message"] = "Mapping web grid"; 
  
      if (Session["PricingSecurities"] == null) 
          Session["PricingSecurities"] = objRepository.GetPricingSecurityID(); 
      if (Session["Cusips"] == null) 
          Session["Cusips"] = objRepository.GetCUSIP(); 
  
      SecurityMappingModel objModel = null; 
      mappings = (List&lt;SecurityMappingModel&gt;)Session["Mappings"]; 
  
      objModel = new SecurityMappingModel(); 
  
  
      if (userAction == "Update" ) 
      { 
          //please tell me how can i take values from Session[Mappings] and pass it to stored procedure? 
          //i'm trying this code
          //foreach (var item in Session)
          //{objModel.Cusips = (List&lt;SelectListItem&gt;)Session["Mappings"];
          //I did function import here (import my sp in model)using EF name            
          //ExecuteMappingsp.
          //dbContext.ExecuteMappingsp(need to pass parameter);
          //} //i know wrong code but how to fix this??
          // PLEASE HELP ME TO RETRIEVE SESSION VALUES
          return RedirectToAction("Index"); 
      } 
      objModel.PricingSecirities = (List&lt;SelectListItem&gt;)Session["PricingSecurities"]; 
      objModel.Cusips = (List&lt;SelectListItem&gt;)Session["Cusips"]; 
      ViewBag.Mappings = mappings; 
      return View(objModel); 
  } 
  </code></pre>
  
  <p>How can I take values from Session[Mappings] and pass it to stored procedure?</p>