Bonjour,
Je me melle les pinceaux, donc je viens demander votre aide.
J'ai un site. Selon l'url de connexion je dois décider qui doit passer par la page de loggin et qui peux passer directement au site.
Mon web.config
Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 <authentication mode="None"> </authentication> <authorization> <allow users="?"/> </authorization>
Ma Master
Code vb : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 Public LaSociete As Societe Protected Sub Master_MasterPage_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init Dim cssLink As HtmlLink = New HtmlLink() cssLink.ID = "lnkCss" cssLink.Href = "~/CSS/ConfMob.css" cssLink.Attributes.Add("rel", "stylesheet") cssLink.Attributes.Add("type", "text/css") Page.Header.Controls.Add(cssLink) If Session(SESSION_SOCIETE) IsNot Nothing Then LaSociete = CType(Session(SESSION_SOCIETE), Societe) Else LaSociete = HelperSociete.URLEstConnu(HelperURL.GetRootURL(True), New CatalogueMobilierEntities) If LaSociete IsNot Nothing AndAlso LaSociete.SsLogin Then 'passe directement Dim LaPers As New Personne LaPers.Nom = LaSociete.RaisonSocial LaPers.Societe = LaSociete LaPers.IdSoc = LaSociete.IdSoc Session(SESSION_USER) = LaPers System.Web.Security.FormsAuthentication.RedirectFromLoginPage(LaSociete.RaisonSocial, False) 'If HelperURL.GetFile(False) = "Login.aspx" Then Response.Redirect("~/Default.aspx") ElseIf Not HttpContext.Current.User.Identity.IsAuthenticated And HelperURL.GetFile(False) <> "Login.aspx" Then 'Doit s'authentifier System.Web.Security.FormsAuthentication.SignOut() Session.Abandon() Response.Redirect("~/Login.aspx") End If End If End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If LaSociete Is Nothing AndAlso HelperURL.GetFile(False) <> "Erreur.aspx" Then Dim Ex As New Exception("Site non reconnu") HelperJournal.WriteEntry("Site non reconnu :" & HelperURL.GetRootURL(True), Nothing, Diagnostics.TraceEventType.Warning) Throw Ex Else If HelperString.ContientInfo(LaSociete.Logo) Then LogoPrincipal.ImageUrl = "~" & PATH_IMG_SOCIETE & LaSociete.IdSoc.ToString & "/" & LaSociete.Logo LogoPrincipal.Visible = True End If End If End Sub
Ma page default.aspx
Code vb : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Page.Title = "Accueil" End Sub End Class
Dans le cas où je dois aller directement, j'ai une boucle infinie. Je passe toujours dans Master et default.aspx. Si je dois passer par la login, ça marche
Quelqu'un peut me dire pourquoi?
Partager