Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
We have an application which is asp.Net 2.0 It's have it's own session management for Login purpose now I want to add one MVC3 application which use asp.net session how can I achieve this ?
Posted
Updated 22-Aug-13 23:52pm
v2
Comments
VishwaKL 26-Aug-13 7:03am    
I feel use state server session management technology that will help you to transfer session values between asp.net/mvc

 
Share this answer
 
You can use either State Server or Sql Server to store your session, and it can be shared by asp.net and MVC application.

State Server is little faster than Sql Server.
 
Share this answer
 
v2
I tried some different I don't know it's correct way or not but I am satisfied that project is working
My target was to check session expiry.
when I login to my ASP.NET 2 Application I Store 1 user name using normal Session variable
Collapse | Copy Code
C#
Session["username"] = txtUserName.Text

I put my MVC3 Solution in that website
In my Controllers Add Delete Update methods was there so when you run MVC Application the Controller and it's method get's called
MVC_APP/TestApp/ADD
Now for this url my Controller was like

C#
public ActionResult ADD()
{
// my code
return View();
}


Now I added one extra parameter


C#
public ActionResult ADD(string userName)
{
if(StringIsnullOrEmpty(userName))
{
   Redirect("Logout.aspx")
}
else
{
// my code
return View();
}
}


In menu click for MVC View
for Eg ADD

C#
Redirect("MVC_APP/testAPP/ADD?userName?="+ Session["userName"])
Redirect("MVC_APP/testAPP/Edit?userName?="+ Session["userName"])


And when anyone clicks on ASP .Net menu automatically view gets called
 
Share this answer
 
Comments
Madhav Hatwalne 3-Sep-13 4:00am    
Thank you all

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