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

Re: asp.net problem by Bob

Bob
Tue Oct 31 09:07:10 CST 2006

Darren Brook wrote:
> Hi
>
> I have an asp.net 2.0 project and am experiencing a problem.

There was no way for you to know it (except maybe by browsing through
some of the previous questions before posting yours - always a
recommended practice), but this is a classic asp newsgroup. ASP.Net is
a different technology from classic ASP. While you may be lucky enough
to find a dotnet-savvy person here who can answer your question, you
can eliminate the luck factor by posting your question to a newsgroup
where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
There are also forums at www.asp.net where you can find a lot of people
to help you.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: asp.net problem by Darren

Darren
Tue Oct 31 09:53:05 CST 2006

Hi - thanks for the reply.

Is "microsoft.public.dotnet.framework.aspnet" a specific newsgroup as I
could not find it?

Thanks
Darren


"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23%23Ob%234P$GHA.1220@TK2MSFTNGP04.phx.gbl...
> Darren Brook wrote:
>> Hi
>>
>> I have an asp.net 2.0 project and am experiencing a problem.
>
> There was no way for you to know it (except maybe by browsing through
> some of the previous questions before posting yours - always a
> recommended practice), but this is a classic asp newsgroup. ASP.Net is
> a different technology from classic ASP. While you may be lucky enough
> to find a dotnet-savvy person here who can answer your question, you
> can eliminate the luck factor by posting your question to a newsgroup
> where the dotnet-savvy people hang out. I suggest
> microsoft.public.dotnet.framework.aspnet.
> There are also forums at www.asp.net where you can find a lot of people
> to help you.
>
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>



Re: asp.net problem by Bob

Bob
Tue Oct 31 09:58:47 CST 2006

I'm looking at it in my newsgroup list right now. I don't understand why
you don't see it. Perhaps you need to reset your newsgroup list.

Darren Brook wrote:
> Hi - thanks for the reply.
>
> Is "microsoft.public.dotnet.framework.aspnet" a specific newsgroup as
> I could not find it?
>
> Thanks
> Darren
>
>
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:%23%23Ob%234P$GHA.1220@TK2MSFTNGP04.phx.gbl...
>> Darren Brook wrote:
>>> Hi
>>>
>>> I have an asp.net 2.0 project and am experiencing a problem.
>>
>> There was no way for you to know it (except maybe by browsing through
>> some of the previous questions before posting yours - always a
>> recommended practice), but this is a classic asp newsgroup. ASP.Net
>> is a different technology from classic ASP. While you may be lucky
>> enough to find a dotnet-savvy person here who can answer your
>> question, you can eliminate the luck factor by posting your question
>> to a newsgroup where the dotnet-savvy people hang out. I suggest
>> microsoft.public.dotnet.framework.aspnet.
>> There are also forums at www.asp.net where you can find a lot of
>> people to help you.
>>
>>
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get
>> a quicker response by posting to the newsgroup.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: asp.net problem by Tim

Tim
Tue Oct 31 11:26:32 CST 2006

"Darren Brook" <D_Brook@btinternet.com> wrote:

>Hi - thanks for the reply.
>
>Is "microsoft.public.dotnet.framework.aspnet" a specific newsgroup as I
>could not find it?

Yes, it is a newsgroup. If your ISP's Usenet server doesn't carry it,
then point your Usenet client at Microsoft's public server:
msnews.microsoft.com

--
Tim Slattery
MS MVP(DTS)
Slattery_T@bls.gov

Re: asp.net problem by Darren

Darren
Thu Nov 02 03:43:50 CST 2006

Many thanks.


"Tim Slattery" <Slattery_T@bls.gov> wrote in message
news:3o1fk21j9bua9qpvemi2l25porm6hji38l@4ax.com...
> "Darren Brook" <D_Brook@btinternet.com> wrote:
>
>>Hi - thanks for the reply.
>>
>>Is "microsoft.public.dotnet.framework.aspnet" a specific newsgroup as I
>>could not find it?
>
> Yes, it is a newsgroup. If your ISP's Usenet server doesn't carry it,
> then point your Usenet client at Microsoft's public server:
> msnews.microsoft.com
>
> --
> Tim Slattery
> MS MVP(DTS)
> Slattery_T@bls.gov