Click here to Skip to main content
16,019,740 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionFTPWebRequest issues Pin
rrlevron31-Oct-06 5:23
rrlevron31-Oct-06 5:23 
Questionhow to connect to DB dynamically in ASP .net Pin
Meena T Shivaram31-Oct-06 5:18
Meena T Shivaram31-Oct-06 5:18 
AnswerRe: how to connect to DB dynamically in ASP .net Pin
wEb GuRu...31-Oct-06 5:58
wEb GuRu...31-Oct-06 5:58 
GeneralRe: how to connect to DB dynamically in ASP .net Pin
Meena T Shivaram31-Oct-06 10:28
Meena T Shivaram31-Oct-06 10:28 
Questionbulk update Pin
karanba31-Oct-06 5:08
karanba31-Oct-06 5:08 
AnswerRe: bulk update Pin
just3ala231-Oct-06 20:30
just3ala231-Oct-06 20:30 
QuestionLocking Client Computer through ASP.Net Pin
aseef31-Oct-06 3:50
aseef31-Oct-06 3:50 
QuestionLogin Control and Roles.... Pin
dbrook00731-Oct-06 3:49
dbrook00731-Oct-06 3:49 
Hi
I have an asp.net 2.0 project and am experiencing a problem.

In the project, I am trying to make use of Membership.

I have one Role, called "Basic User" and two users - "admin" and "test".

"admin" is a member of the Role but "test" is not.

I have only a few pages in the project at the moment: -

• SecurePage.aspx - The page I want only authenticated users that are members of the Role to use.
• Login.aspx - Login page
• Unauthorized.aspx - Informs user that they cannot view the secure page because of a lack of permissions

SecurePage.aspx just contains a ChangePassword control.

Unauthorized.aspx has some text and a LoginStatus control.

So in the SecurePage.aspx, I have this code to handle this: -

Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)

If User.Identity.IsAuthenticated = False Then
Server.Transfer("login.aspx")
End If

If Roles.IsUserInRole("Basic User") = False Then
Server.Transfer("unauthorized.aspx")
End If

End Sub

If I go to the SecurePage and am not authenticated, it transfers me to login.aspx.

If I then login with the user "admin", which is in the Role "Basic User", it works ok.

If I first login with "test", which is NOT in the Role, then I am transfered to the "unauthorized.aspx" page.

However, if I click "Logout" on the LoginStatus control on the "unauthorized" page it refreshes and changes to display "Login".

So, if I then click "Login", I am taken back to the login page. The URL in the address bar at this point is: -

http://localhost:1489/Lesson09/login.aspx?ReturnUrl=%2funauthorized.aspx

If I then login with using "admin" - which is a member of the Role - this is where I get a problem.

Instead of being taken to the SecurePage.aspx as expected, I get taken back to the "unauthorized.aspx" page.

This is obviously wrong.

Now, I know that this should work but does anybody know why it is not working?

Is there some settings or something I need to change on my PC? Am I missing a step or not doing something?

I've checked the obvious things - like that the user was actually in the Role etc.

However, I just cannot get this to work.

I am new to ASP.Net and so I don't really know where to start to look for what the problem is?

I have gone through re-doing the project twice now and I still get the same problem.

For info, I am using: -

- Visual Studio .Net 2005 (Professional) (up to date)
- Latest .Net installed
- Windows XP Pro
- Internet Explorer 6 (version 6.0.2900.2180.xpsp_sp2_gdr.050301-1519) SP2

I would very much appreciate any help or advice on this problem.

Thanks in advance.

Kind regards
Darren Brook
email: darrenbrook@btconnect.com




Questioncustom validator Pin
gus_br31-Oct-06 3:43
gus_br31-Oct-06 3:43 
AnswerRe: custom validator Pin
ednrgc31-Oct-06 5:33
ednrgc31-Oct-06 5:33 
GeneralRe: custom validator Pin
gus_br31-Oct-06 6:44
gus_br31-Oct-06 6:44 
AnswerRe: custom validator Pin
P A N K A J31-Oct-06 22:45
P A N K A J31-Oct-06 22:45 
Questionattibutes.add Pin
rkmoray31-Oct-06 2:33
rkmoray31-Oct-06 2:33 
AnswerRe: attibutes.add Pin
just3ala231-Oct-06 20:32
just3ala231-Oct-06 20:32 
QuestionASP.net Reset Button Pin
wEb GuRu...31-Oct-06 2:27
wEb GuRu...31-Oct-06 2:27 
AnswerRe: ASP.net Reset Button Pin
ednrgc31-Oct-06 3:50
ednrgc31-Oct-06 3:50 
GeneralProblem not yet solved Pin
wEb GuRu...31-Oct-06 5:48
wEb GuRu...31-Oct-06 5:48 
GeneralRe: Problem not yet solved Pin
ednrgc31-Oct-06 5:57
ednrgc31-Oct-06 5:57 
GeneralRe: Problem not yet solved Pin
wEb GuRu...31-Oct-06 6:07
wEb GuRu...31-Oct-06 6:07 
GeneralRe: Problem not yet solved Pin
ednrgc31-Oct-06 6:34
ednrgc31-Oct-06 6:34 
GeneralRe: Problem not yet solved Pin
wEb GuRu...31-Oct-06 6:59
wEb GuRu...31-Oct-06 6:59 
GeneralRe: Problem not yet solved Pin
ednrgc31-Oct-06 7:32
ednrgc31-Oct-06 7:32 
QuestionFCK Editor Pin
srinandan..31-Oct-06 1:23
srinandan..31-Oct-06 1:23 
QuestionRe: FCK Editor Pin
just3ala231-Oct-06 1:37
just3ala231-Oct-06 1:37 
AnswerRe: FCK Editor Pin
Tamimi - Code31-Oct-06 1:44
Tamimi - Code31-Oct-06 1:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.