Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to Session sharing asp.net to mvc ?

I tried this link http://www.codeproject.com/Articles/27090/Sharing-Session-Across-Applications , but It didnt work
Posted
Comments
Jameel VM 29-Aug-13 10:32am    
Please post your code what you have tried
teamberks 29-Aug-13 10:55am    
ı added

Session In MVC[^]

You can check the link..hope it will help..
 
Share this answer
 
I added 2 projects this dll
XML
Femiani.Web.Modules.SharedSessionModule


web site 1 code 



 <div>
        <asp:textbox id="txtEnterData" runat="server" xmlns:asp="#unknown" />
        <br />
        <asp:label id="lblSavedData" runat="server" xmlns:asp="#unknown" />
        <br />
        <asp:button id="btnSave" text="Kaydet" onclick="Save_Click" runat="server" xmlns:asp="#unknown" />
        <br />
        <br />
        <asp:hyperlink id="lnkNextApp" text="MVC git" runat="server" xmlns:asp="#unknown" />
    </div>
           protected void Page_Load(object sender, EventArgs e)
          {
           // lnkNextApp.NavigateUrl = "http://localhost:7048/Home";

             lnkNextApp.NavigateUrl = "http://localhost:7848/SessionSharingAspNet3/Default.aspx";
           }

          protected void Save_Click(object sender, EventArgs e)
         {
            Session["DATA"] =  txtEnterData.Text;
              lblSavedData.Text = string.Format("'{0}' Session save", txtEnterData.Text);


            string ss = Session["DATA"].ToString();
           }         


<configuration>
  <appsettings>
    <add key="ApplicationName" value="SharedWeb" />
  </appsettings>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetframework="4.0" />
    <httpmodules>
      <add name="SharedSessionModule" type="Femiani.Web.Modules.SharedSessionModule, Femiani.Web.Modules.SharedSessionModule" />
    </httpmodules>
  </system.web>
  <system.webserver>
    <modules runallmanagedmodulesforallrequests="true" />
  </system.webserver>
</configuration>



web site 2 code

             protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["DATA"] == null)
        {
            lblSession.Text = "Session Yok";
        }
        else
        {
            lblSession.Text = Convert.ToString(Session["DATA"]);
        }

    }


<configuration>
  <appsettings>
    <add key="ApplicationName" value="SharedWeb" />
  </appsettings>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetframework="4.0" />
    <httpmodules>
      <add name="SharedSessionModule" type="Femiani.Web.Modules.SharedSessionModule, Femiani.Web.Modules.SharedSessionModule" />
    </httpmodules>
  </system.web>
  <system.webserver>
    <modules runallmanagedmodulesforallrequests="true" />
  </system.webserver>
</configuration>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900