How To Redirect User From Login Page To Next Page Base On Their Role In C#

Jul 26, 2010

I am using built-in asp.net Role and membership provider in my website. when user login to my system they are redirected to hompage. how should i code it. that when he click on login button page check its role and then decide where to redirect. Suppose user login with name John and "john" is "Admin" then application Redirect him to AdminPanel.aspx and if User john is normal "RegUser" Role then redirect him into Home.aspx.

View 1 Replies


Similar Messages:

User Controls :: How To Redirect To Login Page If User Directly Visits Page In MVC

Jun 11, 2013

i am developing one application in mvc my problem is after login it will redirect to some page if i copy url and paste it in another browser its showing error in application but i need to display home page? 

how to solve this ?

View 1 Replies

User Controls :: Validate Session Set After Login And Redirect User Back To Login Page If It Is NULL

Apr 26, 2013

I have made a web page in which there is login screen when user login it goes next page but my problem is if i directly enter the url of that page it open. I want it should not open unless the user log in... 

View 1 Replies

Security :: Redirect User Based On Role To Specific Web Page?

Apr 22, 2010

I'm not sure if this is possible or not, I'm using Roles to limit what pages a user can access based on there assigned Role. My question, is there anyway to redirect the user to a specific web page based on thier role after they login.

For example:

If Bob logs in with Role="Automotive", I want him to be redirected to Auto.aspx.If sue logs in with Role="Clothing", i want her to be redirected to cloths.aspx.

View 8 Replies

How To Redirect A User To A Member Only Web Page After The Login Page

Mar 28, 2010

I am trying to redirect a user to a member only web page after the login page.
I have the following web forms.
LoginForm.aspx
PublicForm.aspx (anyone can see)
SecureForm.aspx (members only)
In the Web.config, I included

Code:

<authentication mode="Forms">
<forms name="Login"
loginUrl="LoginForm.aspx"
protection="All"
slidingExpiration="true"
path="/">
</forms>
</authentication>
<authorization>
<deny users="*"/>
</authorization>
<location path="PublicForm.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
<location path="SecureForm.aspx">
<system.web>
<authorization>
<deny users="guest"/>
<allow users="member"/>
</authorization>
</system.web>
</location>
</authorization>
For the Login button in the LoginForm.aspx, I used this

Code:

FormsAuthentication.RedirectFromLoginPage(txtID.Text.Trim, False)
This code directs me to the Default.aspx which has nothing in it.
I will have a 404 if I take out the Default.aspx.

View 11 Replies

C# - How To Implement User Base Security Not Role Base

Apr 26, 2010

I have to implement User base security in my Web project using .Net3.5. Followings are some we need:

Roles can be Admin, Manage, Editor, Member etc User can have multiple roles Every roles has its own dynamic menus and restrictions/resources All menus and interface will populate dynamically from Database

I heard some where this kind of i.e user base security can be implemented using HashTable but I dont know how is it?

Today I came to know that for this kind of work Java people use Interceptor Design patterns. So, how could I do the same in asp.net C#?

View 2 Replies

Web Forms :: On Logout Redirect User To Login Page If User Clicks Back Button Of The Browser

Jul 9, 2010

after user loggs out if he clicks the browsers back button then users had to be redirected to login page

doenst matter how many time the user clicks on back button take him to login page

how to achieve this let me know

View 6 Replies

How To Redirect Unauthorized User To A Login Page

Mar 19, 2010

I have myown login page.If any user access any page directly(without login),i want to redirect unauthorized user to login page....How it possible.....Using Generic Handler is there any chance? or how can i do it ?

View 2 Replies

Security :: Page Redirect When User Login?

Mar 24, 2010

I got a role call "Staff", staff registration is done by admin so when creating a new staff only need their name, user name, password and e-mail. After registering, i wan to redirect the staff to the creating profile page to input their contact number and self-description which is a must for later use. For first time login staff, how do i compare and see if the contact and description profile is empty or not? If it is empty, then redirect to the create profile page, else just go to staff page.

I trying to do like making each different role redirect to their own page once they had login. For now when the user login they will remain in the same page showing the login template. How do i do that?

[code]....

View 2 Replies

C# - Redirect User To A Specific Page After Login?

Jan 25, 2011

In web application, after login "ReturnUrl" going to last visited page. How to set to go default.aspx.

I declared code in web.config like this.

<forms name="FormsAuth" loginUrl="Default.aspx" defaultUrl="Default.aspx"
path="/" timeout="200" slidingExpiration="true">

But If I close application at /Private/Admin/ReviewIssue.aspx page.

When I start again application in login page url has like this

[URL]

I want from login page to Default.aspx only.

View 1 Replies

.net - Redirect To Login Page If User Try To Copy The Url In Another Sub Tab?

Mar 24, 2011

I have created a session in asp.net C# page, i'm storing user uniqueid in session like this,Session["userid"] = clsUser.UniqueId;and checking this unique id on each page and redirecting if session is null. But if i copy the users current URL in other tab of IE, it is not redirecting to login page. Instead it is maintaining session across the browser subtabs.How can i redirect to login page if user try to copy the url in another sub tab?

View 3 Replies

C# - SQL Role Security + Custom .Net Base Page?

Feb 8, 2010

I'm workng on a new, green-field ASP.Net application. We're implementing a base page which all pages will be, er, based on. The application will be running under Integrate Windows Auth, so I'll have the user's account details. With these, I'll be going to several databases (in which the user will exist) to find out what roles they are assigned to in each db. I'll be holding the role yay/nay in a bool array, and key into it via an enum.

There will be a session object that will hold a few things, and the roles assigned for that user. I'm thinking of making the session object available as a property of the base page, as the code would be something like this:

public SessionObject MasterSessionObject
{
get
{[CODE]....

But, I'm sure you'll agree, it looks sucky...If there was a CheckSecurity method on the base page, it would have to take a concrete DatabaseRoles object, but also an enum of which role to check, which would also look sucky. And finally, there would be a requirement at a later date to add more databases and their security settings...

I'll add code tomorrow if required... :-s

I dunno, I'm not that thick, but I do have a hard time sometimes binding all this together...

View 1 Replies

Security :: Role Base Access Page?

Dec 25, 2010

I have a Table In DataBase Role.

Which Contain the Role

1. SuberAdmin

2. Admin

3. Coordinator

4. Agency

5. Agent

Which have the different- different Access of pages so now how i give the seetings in Web to access the page according to role.

View 8 Replies

Prevent URL Entry And Redirect The User To Login Page?

Oct 26, 2010

I am using forms authentication on ASP.NET. If I try to access a page by copying the query string and pasting it into the browser, it allows me access to the page. How can this be prevented? I want the user to always have to login.

View 4 Replies

Security :: Redirect User To Login Page And Back

Nov 19, 2010

How would I go about to solve this:

When the user clicks a button and the user has been inactive for too long (session is gone), then redirect the user to the login page and back to the current page after logging in?

Is there a built in solution to this or do I have to do it manually? If so, how?

View 10 Replies

C# - Programmatically Login To A Website And Redirect The User To The Logged In Page?

Mar 15, 2010

Right now, I have all the employees of my company login to an external website using the company id, username and a password. We are trying to integrate it into an intranet portal which should provide seamless access to this website without requiring the user to enter these credentials.

Is there any way of doing this programmatically (.NET C#)? Very similar to screenscraping, Can I simulate the appropriate POST action and then redirect the user to the logged in page?

View 3 Replies

Security :: Authenticating User After Logout And Redirect To Login Page

Dec 20, 2010

In my web application when I start my webpage from Visual Studio the URL to my ligin page looks like this:

[Code]....

And when logging out, the following are executed:

[Code]....

Question: I need to have the return URL set to Default.aspx as it is when logging in the first time. Does anyone know how I can achieve that?

View 1 Replies

Web Forms :: After Successful Login And Redirect User To Page Requested

Jan 13, 2013

In my asp.net and vb code web. there is some pages which require username and password to access it. when the user clicks on the link for this page it directs to the login page and if the username and password is correct then it is directed to default page and not to the page requested.

Code in my .vb page is as under

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("userid") = Nothing Then
Response.Redirect("login.aspx")
End If
End Sub

View 1 Replies

Security :: How To Redirect The User Automatically To Login Page After Session Expiration

Mar 10, 2010

How i redirect the page to Login page automatically if session Expires .

View 7 Replies

State Management :: Redirect User To Login Page If Session Is Null?

Sep 7, 2010

i have 2 page,

1.login.aspx --- 2.welcome.aspx

in my login.aspx im storing username into sesssion as below:

Session["usernm"] = txtUsername.Text;
in my welcome.aspx page
in page_load event
if (Session["usernm"]==null)
{
Response.Redirect("Login.aspx");
}

here if i manulally paste the url ( http://localhost:4125/Loginado/welcome.aspx) it should go to login.aspx for user credentials

but its going directly to welcome.aspx page.

View 5 Replies

Security :: How To Redirect User To An Error Page From Login Control Upon Entering Wrong Username

Mar 1, 2011

I wanted to know how to add the feature- that user should be redirected to an error page where the error will be display, upon entery wrong username/password when trying to login through an asp.net login control?

1. how to redirect the user to an error page upon entering wrong username/password (from a login control which is placed on master page)?

2. how to pass the error to the error page so it can be displayed there?

View 28 Replies

Web Forms :: How To Redirect To Login Page When Any Page Is Idle For 5 Minutes

Feb 23, 2010

I want to redirect to login page when any page is idle for 5 minutes and after re login I want to redirect to the page user is earlier in .

View 2 Replies

State Management :: Redirect Page To Login Page On Logout?

Dec 2, 2010

In logout link's click event i have written Session.Abandon() that will destroy the Session state.I am also handling Session_End event that is fired afterward (written in Global.asax). But one more thing i want is that after Session ends, login page should be redirected (opened).

For that i wrote:

[Code]....


This is working fine on the surface, but after applying debugging i saw that there were unexpected number of calls to Session_Start and Session_End events for two times, then login page was opened.

Why Session_Start and Session_End was called two times ? If i left this process as it is working then may i get some serious error in future ?

View 4 Replies

Web Forms :: Redirect To Requested Page Instead Of Default Page After Login?

Jul 17, 2015

I have created an order checkout page.when i click checkout button then it check user login or not if not then it redirect to login page .after login i want to show

my previous link page

View 1 Replies

MVC :: How To Redirect To Login Page When Access A Page After Logout

Nov 19, 2010

usually in asp.net mvc there is thing [authorize]...which will allow users only after authetication...but this works on in bulit logins in asp..

now am creating my own login...with user name and password...afteri logout...when user tries to access the home of my it should redirect to login page...and the cache should be cleared

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved