I am developing classified ads application in ASP.NET MVC3 using Entity Framework 4.3 for database.
I am facing problem when user session is active and execute any database query by entity framework then application session time's out unexpectedly.
Note that the query gets execute successfully and I can see my results as well but after a little while asp.net session terminates.
This only happen when I host my application to the live server (Arvixe). On my Local IIS it is working fine.
If I use any other source for database query then it is working fine.
I have also reset session time-out in web.config. I am using MYSQL. Any thoughts?
I am using this simple login method and it is working fine..
using (Html.BeginForm("ValidateLogin", "User", FormMethod.Post))
{
<div>
<input type="text" name="LoginName" id="LoginName" />
<input type="password" name="Password" id="Password" />
<p>
<input type="checkbox" name="RememberMe" /><span>Remember me?</span></p>
<input id="Submit1" type="submit" value="submit" />
</div>
}
[HttpPost]
public ActionResult ValidateLogin(string LoginName, string Password, string RememberMe)
{
User aUser = new User(); //User Class
var userList= db.Users.Where(u => (u.Loginname.ToLower() == name.ToLower() || u.Email == name) && u.Password == password);
if (Users.Count() > 0)
{
aUser = Users.Take(1).Single();
Session.Add("user",aUser.UserId);
return RedirectToAction("Index", "Home");
}
else
{
return RedirectToAction("Login", "User", new { error = "login" });
}