how to create this class?

C

Chris

Hi,

i need to check on every page whether a user is logged or not. If yes, the
theme must be changed.

I first tried with the code here below (without class) but this works only
for the (redirected) default.aspx file (the
code-behind can't be put in masterpage.master.vb because
'User.Identity.IsAuthenticated ' is not recognized!).

in masterpage.master:
<header>
<link id="Lkred" href="App_Themes/red/red.css" rel="Stylesheet"
type="text/css" visible="true"/>
<link id="lkgreen" href="App_Themes/green/green.css" rel="Stylesheet"
type="text/css" visible="false" />
</header>


in default.aspx.vb:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If User.Identity.IsAuthenticated Then
If Master.FindControl("lkred").Visible = True Then
Master.FindControl("lkred").Visible = False
Master.FindControl("lkgreen").Visible = True
Else
Master.FindControl("lkred").Visible = True
Master.FindControl("lkgreen").Visible = False
End If
End If
End Sub

So i would like to create a Class in order to put the code on a central
place instead to have to copy it in every page. But the problem is now: how
to define 'User.Identity.IsAuthenticated'? I can't find a type 'user' or
something..

Any help would be appreciated.
Thanks
Chris

Public Class loginkl
Public Sub logkl()

dim us as ??
End Sub
End Class
 

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

Top