Are you using login control or textboxes for logging in? If you are using login control, then there will be a property "DestinationPageUrl", which
you can set to the aspx page that you want to show after successful login
re you using login control or textboxes for logging in? If you are using login control, then there will be a property "DestinationPageUrl", which you
can set to the aspx page that you want to show after successful login
I have used textboxes for login...
after successfull login, user redirects on add.aspx page but what if he tries to open any page in betwn & then after login ???
Use System.Web.Mvc.AuthorizeAttribute on your controller actions. It will redirect unauthenticated users to login page with ReturnUrl query string. User this query string to redirect users back to intended page after successful
login.
Use System.Web.Mvc.AuthorizeAttribute on your controller actions.
Sorry, I didn't see properly. I thought you are using ASP.NET MVC
If you are using some custom logic for authenticating and redirecting user to login page. You can add original url in query string while redirecting to login page and redirect back to that page on successful login.
if you want to restrict users to certain pages based on their role(if any) then use membership. i am not able to get what you are trying to achieve. :(
if you want to restrict users to certain pages based on their role(if any) then use membership. i am not able to get what you are trying to achieve. :(
I am using textboxes control for login & I am using session...
I have 3 pages which are report.aspx, add.aspx, user.aspx...
After login, I redirect user to user.aspx Page...
Now i have nt login & im trying to open page report.aspx but im not login so of course, it will redirect me on login.aspx page.
but after i login, i want the website to redirect me on report.aspx page...
Now i have nt login & im trying to open page report.aspx but im not login so of course, it will redirect me on login.aspx page.
but after i login, i want the website to redirect me on report.aspx page...
As I said earlier, when you redirect not-loggedin user from Reports.aspx to Login.aspx, pass the url of report.aspx as a query string to login.aspx. After user logs in, check if there any url in query string. If yes, redirect user back to that url. In this
case it's reports.aspx.
jeeten09
Member
122 Points
150 Posts
Redirect to corresponding page after LogIN
Apr 01, 2012 06:16 AM|LINK
Hello all,
How to redirect to corresponding page after login ???
I mean that if some1 tries to open page Report.aspx but bcz of login security, he gets page of login.
After successful login, I want to redirect the page Report.aspx...
ramesh866
Participant
1467 Points
375 Posts
Re: Redirect to corresponding page after LogIN
Apr 01, 2012 07:09 AM|LINK
hi,
Are you using login control or textboxes for logging in? If you are using login control, then there will be a property "DestinationPageUrl", which you can set to the aspx page that you want to show after successful login
Stoian Bucov...
Participant
1685 Points
265 Posts
Re: Redirect to corresponding page after LogIN
Apr 01, 2012 07:16 AM|LINK
Login.aspx page code
Private Sub buttonLogin_Click (ByVal sender as object, ByVal e as system.eventargs) handles buttonLogin.Click
if textboxUserName.text = "admin" and textboxPassword.text = "password" then
Session("IsAuthenticated") = true
End If
End Sub
Report.aspx page
Private Sub Page_Load (Byval sender as object, Byval e as System.EventArgs) Handles Me.Load
if Session("IsAuthenticated") Is Nothing or Session("IsAuthenticated") <> true then
Response.redirect("~/Login.aspx", true)
End if
End Sub
jeeten09
Member
122 Points
150 Posts
Re: Redirect to corresponding page after LogIN
Apr 01, 2012 08:56 AM|LINK
I have used textboxes for login...
after successfull login, user redirects on add.aspx page but what if he tries to open any page in betwn & then after login ???
tdesai
Member
151 Points
34 Posts
Re: Redirect to corresponding page after LogIN
Apr 01, 2012 09:31 AM|LINK
Use System.Web.Mvc.AuthorizeAttribute on your controller actions. It will redirect unauthenticated users to login page with ReturnUrl query string. User this query string to redirect users back to intended page after successful login.
tdesai
Member
151 Points
34 Posts
Re: Redirect to corresponding page after LogIN
Apr 01, 2012 09:50 AM|LINK
Sorry, I didn't see properly. I thought you are using ASP.NET MVC
If you are using some custom logic for authenticating and redirecting user to login page. You can add original url in query string while redirecting to login page and redirect back to that page on successful login.
ramesh866
Participant
1467 Points
375 Posts
Re: Redirect to corresponding page after LogIN
Apr 01, 2012 10:34 AM|LINK
if you want to restrict users to certain pages based on their role(if any) then use membership. i am not able to get what you are trying to achieve. :(
boonmathew
Member
96 Points
56 Posts
Re: Redirect to corresponding page after LogIN
Apr 01, 2012 01:13 PM|LINK
If you are using a session, u can check the session whether it is a null value using if loop..
if it is null then, redirect to login page..
jeeten09
Member
122 Points
150 Posts
Re: Redirect to corresponding page after LogIN
Apr 04, 2012 04:32 AM|LINK
I am using textboxes control for login & I am using session...
I have 3 pages which are report.aspx, add.aspx, user.aspx...
After login, I redirect user to user.aspx Page...
Now i have nt login & im trying to open page report.aspx but im not login so of course, it will redirect me on login.aspx page.
but after i login, i want the website to redirect me on report.aspx page...
I have u understood my problem ???
tdesai
Member
151 Points
34 Posts
Re: Redirect to corresponding page after LogIN
Apr 04, 2012 06:03 AM|LINK
As I said earlier, when you redirect not-loggedin user from Reports.aspx to Login.aspx, pass the url of report.aspx as a query string to login.aspx. After user logs in, check if there any url in query string. If yes, redirect user back to that url. In this case it's reports.aspx.
Hope this clears your doubt.