Use Form Authentication to control visibility of tag for logged-in users

L

liuhang

Hi, guys,

I'm trying to migrate one of my application written in .NET 1.1 to the
new 2.0, and keep the Form type Authentication for the login part,
which should only show the LogOff tag on the banner to logged-in users.
Currently I'm having problem to show the LogOff tab after valid user
login. It works fine when I browse it using "View In Browser" in my
VS2005, but if i open a new IE and start from localhost, it doesn't
work. The code of the authentication part in my Banner.ascx.vb looks
like:

...... ......
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim tabItems As New ArrayList

If Request.IsAuthenticated = True Then
' If isAuthenticated add log tab
' add the Log tab (all users can see this tab)
... ...

tabItems.Add(New TabItem("Other",
"otherPage.aspx?index=" & tabItems.Count))
tabItems.Add(New TabItem("Help", "ctnHelp.aspx?index="
& tabItems.Count))
...... ......
End If

'Show log off button if user is form authenticated
If Context.User.Identity.AuthenticationType Is "Forms" Then
LogOff.Visible = True
End If
.....

and in my web.config I've included:

<authentication mode="Forms">
<forms name=".ASPXAUTH" protection="All" timeout="60"
loginUrl="desktopdefault.aspx"/>
</authentication>
<identity impersonate="true"/>

Is it related to the configuration of ASP.NET 2.0 security in IIS, and
even cookies? I've searched on Google and still cann't find an answer
so far. Does any of you have idea what the problem could be and how
should I overcome it?

TIA. Alan
 
P

Patrick.O.Ige

It looks as if the Context User Idenetity is lost when viewing from
localhost
Patrick
 
A

Alan

Patrick, thanks for the reply. That's one of the reason I've thought of
too. So I guess it's not a ASP.NET problem but rather is associated w/
the IIS configuration. I didn't see anything wrong w/ the settings in
my IIS, it's where I'm stuck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top