i need to check on every page whether a user is logged or not. If yes, the
theme must be changed.
I first tried like this but this works only for the 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..
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Chris
page.User.Identity.IsAuthenticated
"Chris" <????@nospam.dc> schreef in bericht news:%
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 like this but this works only for the 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
page.User.Identity.IsAuthenticated
"Chris" <????@nospam.dc> schreef in bericht
news:%23NCMcYnXHHA.984@TK2MSFTNGP04.phx.gbl...
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 like this but this works only for the 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..
"Chris" <????@nospam.dc> schreef in bericht news:%
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 like this but this works only for the 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..