title: How to clear session using jquery?
body: <p>I am developing mvc application. I used session in view and controller. 
   First when i select value from dropdown list. selected value is managed in view and controller.
  but when I again select value from dropdown list , that time on change event I want to clear session.</p>
  
  <p>below is my code for view</p>
  
  <pre><code>@model IEnumerable&lt;StockWatch.DTO.ProductDTO&gt;
  
  @using GridMvc.Html
  @using System.Web.UI.WebControls;
  
  @{
      ViewBag.Title = "Index";
      int VendorId = Convert.ToInt32(Session["vendorId"]);
  }
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
      &lt;head&gt;
           &lt;link href="@Url.Content("~/Content/Custom1.css")" rel="stylesheet" type="text/css" /&gt;    
     &lt;/head&gt;
  &lt;body&gt; 
  
       @if (Model == null)
       {
  
      &lt;div id="vendorDropdownDiv" class =" row-fluid Span9" style ="margin-bottom :15px"&gt;
  
                     &lt;div class="span6"  &gt;
                             &lt;div class="span4" style="margin-left:35px;" &gt;
                           &lt;label &gt;Vendor&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class="span6" &gt;
                        @Html.DropDownList("VendorId", ViewData["list"] as SelectList, "-- Select vendor --", new { @id = "vendorDropdown", @name = "VendorId" })
  
                    &lt;/div&gt;
                   &lt;/div&gt;                              
  
                   &lt;div class="span11" style="text-align:right"&gt;           
                  &lt;input class="btn btn-primary" type="submit" value="Create" id="create"/&gt;
                   &lt;input class="btn btn-default" value="Cancel" style="width:45px;" onclick="window.location.href='@Url.Action("index")    '"/&gt;
             &lt;/div&gt;
                &lt;/div&gt; 
       }    
  
    &lt;div id="indexview"&gt;&lt;/div&gt;
  
       @if (Model != null)
       {
      &lt;div id="modeldiv" class="span12" style="margin-left:0px;margin-right:0px;"&gt;
         &lt;div class="row-fluid" style="margin-top:30px;margin-bottom:10px;"&gt;
         &lt;div class="listheading span9" style="font-size:22px;"&gt;Products&lt;/div&gt;
  
        &lt;div class="createlink span3" style="text-align:right;margin-left:10px;"&gt;
         @Html.ActionLink("+ Add Product", "Create")
      &lt;/div&gt;
    }     
  &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;script&gt;
      $(document).ready(function () {      
          $('#vendorDropdown').change(function () {                  
          }); 
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>and controller code as below</p>
  
  <pre><code>       public ActionResult Index(int VendorId=0)
      {
          if (VendorId == 0)
          {
              VendorId = Convert.ToInt32(Session["vendorId"]);
          }
  
          VendorService vendorService = new VendorService();
          SelectList SelectList = new SelectList(vendorService.GetAll().OrderBy(t =&gt; t.Name), "Id", "Name", VendorId);
          ViewData["list"] = SelectList;
  
          var Categorylist = new SelectList(new[] { "Dull", "Anodised", "All" });
  
          ViewData["Categorylist"] = Categorylist;
  
          if (VendorId != 0 )
          {
              Session["vendorId"] = VendorId;
              ProductService productService = new ProductService();
              var productlist = new List&lt;ProductDTO&gt;();             
              productlist = productService.GetAll().Where(x =&gt; x.VendorId == VendorId).ToList();
  
              return View(productlist );
          }
          else
          {
              return View();
          }
      }
  </code></pre>
  
  <p>here how to clear <code>Convert.ToInt32(Session["vendorId"]);</code> this session using jquery.
  thank u in advance</p>