473,385 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ASp.net 2.0 Authentication

Hi,

I'm using asp.net 2.0 authentication with sql server 2005. I have also roles
and I'd like to authenticate a user and then send them to specific page
depending on roles.
This is what I'm using:

If Membership.ValidateUser(TextBox1.Text, TextBox2.Text) Then
FormsAuthentication.SetAuthCookie(CStr(TextBox1.Te xt), False)

If Context.User.IsInRole("Parents") Then

Response.Redirect("AppsHtml/Roles/Parents.aspx", True)

End If

Else

Label3.Visible = True
End If

The problem is that when I run the application to try, I fill Login and
pass, I press the button but nothing happens. When I press the button a
second time then I get redirected to the correct page.

I have also a web.config file with locations:

<location path="AppsHtml/Roles/Parents.aspx>
.....
<allow roles="Parents"/>
<deny users="*"/>
.....
Any Idea of what I'm doing wrong?

Thanks

Juan Puebla
Dec 5 '05 #1
1 895
Understand that your sends the Cookie to the client using a header in HTTP -
you need to do a roundtrip before you can request values from the cookie.

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Juan Puebla" <Ju********@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
Hi,

I'm using asp.net 2.0 authentication with sql server 2005. I have also
roles
and I'd like to authenticate a user and then send them to specific page
depending on roles.
This is what I'm using:

If Membership.ValidateUser(TextBox1.Text, TextBox2.Text) Then
FormsAuthentication.SetAuthCookie(CStr(TextBox1.Te xt), False)

If Context.User.IsInRole("Parents") Then

Response.Redirect("AppsHtml/Roles/Parents.aspx", True)

End If

Else

Label3.Visible = True
End If

The problem is that when I run the application to try, I fill Login and
pass, I press the button but nothing happens. When I press the button a
second time then I get redirected to the correct page.

I have also a web.config file with locations:

<location path="AppsHtml/Roles/Parents.aspx>
....
<allow roles="Parents"/>
<deny users="*"/>
....
Any Idea of what I'm doing wrong?

Thanks

Juan Puebla

Dec 5 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
8
by: Bob Everland | last post by:
I have an application that is ISAPI and the only way to secure it is through NT permissions. I need to have a way to login to windows authentication so that when I get to the ISAPI application no...
6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
9
by: Tom B | last post by:
In my web.config file I've specified Windows for the authentication, in IIS I've set it to Integrated Authentication. But my SQL connection is still showing Anonymous. Is there somewhere else I...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
4
by: Andrew | last post by:
Hey all, I would like to preface my question by stating I am still learning ASP.net and while I am confident in the basics and foundation, the more advanced stuff is still a challenge. Ok....
0
by: Albertas | last post by:
What I'm doing wrong that I can't make my authentication to work. Here is the situation: I'm hosting a Web Service from a Windows forms application, using .NET Framework 3.0 WCF. And I want to...
18
by: troywalker | last post by:
I am new to LDAP and Directory Services, and I have a project that requires me to authenticate users against a Sun Java System Directory Server in order to access the application. I have found...
2
by: Frank Swarbrick | last post by:
I am trying to understand "client authentication" works. My environment is DB2/UDB LUW 8.2 on zSeries SLES9 as the database server and DB2 for VSE 7.4 as the client. We currently have DB2/LUW set...
5
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.