Mono Support By Pass the User Authentication on Web Page (Closed)

Viewed 108546 time(s), 17 post(s), 10/12/2011 11:49:36 AM - by ashutosh0901
10/12/2011 11:49:36 AM
353 Reputation 46 Total posts

I want to by pass the user authentication page which is Login.aspx though my page..where user is already providing username and password.

1
10/12/2011 12:13:53 PM
3016 Reputation 428 Total posts

If I understood correctly you have created your own login page and you want your page to be rendered when an user clicks on login link?

Regards

2
10/12/2011 12:31:10 PM
353 Reputation 46 Total posts

No, i have created a page which carry username and password in a session variable from my page to your login page , now i want that your login page should take the my session value without asking for the credentials and redirect to the page which comes after we login to your login page.....

3
10/12/2011 12:42:05 PM
353 Reputation 46 Total posts

Please reply its urgent

4
10/12/2011 1:13:43 PM
3016 Reputation 428 Total posts

You need to add some code to login page so here are the necessary steps:

1. First you need to retrieve your username and password from session on Login page. You can add all the code in Login.aspx .cs. to it's load method.
2. Use below code snippet to validate user

Membership.ValidateUser(username, password);

3. Then use this code snippet:

FormsAuthentication.SetAuthCookie(username, true);

4. And redirect user:

ctlLogin.RedirectAfterLogin();

Regards

5
10/12/2011 1:41:24 PM
353 Reputation 46 Total posts

Thank you so much for your valuable time. It certainly solved my problem

6
10/12/2011 2:06:34 PM
353 Reputation 46 Total posts

Membership.ValidateUser(username, password);
FormsAuthentication.SetAuthCookie(username, true);
ctlLogin.RedirectAfterLogin();

i used these codes on login.aspx page , now when i run the application it is always loggin as administrator even if the person is having user roleid

7
10/12/2011 2:50:21 PM
353 Reputation 46 Total posts

Please reply

8
10/12/2011 3:07:50 PM
7207 Reputation 956 Total posts

We cannot reproduce this behavior. If you pass the correct username to the SetAuthCookie method, it should work as expected. Could you check that the user data that you store in the session store is correct?

9
10/12/2011 4:12:26 PM
353 Reputation 46 Total posts

My only motive is not to show login.aspx or login panel used in the login.aspx when user come through my page , user should directly gets signed in and when he click on logout it show come back to my page.

but currently it is getting logged in but when i refresh the login.aspx page and that textboxes are visible

10
1 2
This is a demo site for MonoX. Please visit Mono Software for more info.