i have the situation -i'm calling controller throught ajax in javascript script which return partial view.now when session end the login page view is loaded in div but i want to redirect to login page not to load login view in div.
Asked
Active
Viewed 1,910 times
1
-
Try `return RedirectToAction("actionname","controllername");` – Karthik Chintala Jan 08 '13 at 10:28
-
still it return view of login page :( – kiransh Jan 08 '13 at 10:53
-
post your view and controller code – Karthik Chintala Jan 08 '13 at 10:55
-
Try this `return View("~/Home/myview.cshtml");` give the path of the view to which you want to redirect – Karthik Chintala Jan 08 '13 at 10:57
2 Answers
1
It will be easier if you use forms authentication. However, this link will help you : http://geekswithblogs.net/shahed/archive/2007/09/05/115173.aspx
Srinivas
- 1,063
- 7
- 15
-
Bro the ajax call to controller in my situation was supposed to return view to div and when session used to be expired it was redirected to login page and that was consider as return view to div.actually session was working but due to ajax call it was being view of login page returned to div.is there any way to redirect the whole web page from controller and redirecting to login page? – kiransh Jan 08 '13 at 10:52
1
Try refer to this post
It will help to create one attribute for login which will help to check every time when the action of any controller is called and perform the task accordingly.
Community
- 1
- 1
user1006544
- 1,514
- 2
- 16
- 26