I made a MVC3 project on asp .net where user login is with ajax. It works normally that, user can go an authorized page after ajax forms authentication(login buttonfires an ajax post) with user’s username and pass info.
But, if user tries to go this unauthorized page with writing direct adress (like: “http://localhost:12799/Anasayfa/Index”) to address bar and hits enter before authentication, he hits the authorization wall and returns back, and inside browser’s address bar a url like “http://localhost:12799/Giris/Index?ReturnUrl=%2fAnasayfa%2fIndex” comes, after this situation, when the user tries normal login, ajax login doesn’t work, login button can not fire ajax post.
I found solution,
My ajax function is like that:
$.post('Giris/GirisGecerliMi', kullanici, girisAjaxReturn);when adress bar is
http://localhost:12799it works with true url. But after adress bar writes ashttp://localhost:12799/Giris/Index?ReturnUrl=%2fAnasayfa%2fIndexajax tries to go a wrong url.After some search, I saw my mistake, I should have written as:
$.post('/Giris/GirisGecerliMi', kullanici, girisAjaxReturn);only a “/” difference solved the problem. Sorry for taking your time.