473,761 Members | 5,848 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with masterpages and security

Hello,

I have a problem with masterpages and forms security.

I made a new Web site, in which I have my page of login like of beginning, a
master page with only a sitemappath object in it, the file of map of the
site,
the web.config and another page to do tests.
In the page redirected from login there are a label and a combo (dropdown)
object
and the only thing this page do is to modify label with the text that this
one has
The problem is that it again redirects me to the login page, i singn in
again an then
the page redirects me to the initial state of the second page, but i nees
that this redirect
to the login page only happens when the 5 minutes timeout is reached.

I put my code down to them, hopefully you see something that is I making
wrong

hanking for beforehand your time and help.
Sergio E.
---------codigo del login.aspx

<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="Login .aspx.vb"
Inherits="Login " %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Login</title>

<link href="Styles/MiStyleSheet.cs s" rel="stylesheet " type="text/css" />

</head>

<body>

<form id="Form1" runat="server" method="post">

<div style="text-align: center">

<asp:Label ID="Label1" runat="server" Text="Reportead or"></asp:Label><br />

<br />

Acceso al Sistema<br />

<table style="width: 395px">

<tr>

<td style="width: 188px">

Usuario:

</td>

<td style="width: 199px">

<asp:TextBox ID="TxtUsuario " runat="server"
Width="150px"></asp:TextBox></td>

</tr>

<tr>

<td style="width: 188px">

Clave:</td>

<td style="width: 199px">

<asp:TextBox ID="TxtPwd" runat="server" TextMode="Passw ord"
Width="150px"></asp:TextBox></td>

</tr>

</table>

<asp:RequiredFi eldValidator ID="RequiredFie ldValidator1" runat="server"
ControlToValida te="TxtUsuario "

Display="None" ErrorMessage="E l campo Usuario no debe estar
vacío."></asp:RequiredFie ldValidator>

<asp:RequiredFi eldValidator ID="RequiredFie ldValidator2" runat="server"
ControlToValida te="TxtPwd"

Display="None" ErrorMessage="E l campo Clave no debe estar
vacío."></asp:RequiredFie ldValidator><br />

<asp:Validation Summary ID="ResumenVali dacion" runat="server" Height="85px"
ShowMessageBox= "True"

ShowSummary="Fa lse" Width="153px" />

<br />

<asp:Button ID="BtnLogin" runat="server" Text="Ingresar" /><br />

<br />

<br />

<asp:Label ID="LblError" runat="server" ForeColor="Red" Text="¡¡¡Error:
Usuario o Clave incorrectos!!!"

Visible="False" ></asp:Label>&nbsp ;</div>

</form>

</body>

</html>

--- codigo en la pagina de login.aspx.vb que define la cookie

Protected Sub BtnLogin_Click( ByVal sender As Object, ByVal e As
System.EventArg s) Handles BtnLogin.Click

dim bUsuarioValido as boolean = ValidaUsuarioEn BDD() 'Este metodo es el que
se conecta a la base de datos y valida realmente al usuario
dim NomPaginaOk as string = "~/Reporte.aspx"

If Not (bUsuarioValido ) Then

Me.LblError.Vis ible = True

Me.TxtUsuario.T ext = ""

Me.TxtPwd.Text = ""

Else

FormsAuthentica tion.SetAuthCoo kie(Me.TxtUsuar io.Text, True)

Session.Add(Var iablesGlobales. NombreVarSesion EstadoAutorizad o,
VariablesGlobal es.ValorEsperad oSesionEstadoAu torizado)

Server.Transfer (NomPaginaOk,Tr ue)

End If

-------------- codigo de la pagina maestra

<%@ Master Language="VB" CodeFile="Heade r.master.vb" Inherits="Heade r" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Report e</title>

</head>

<body>

<form id="form1" runat="server">

<div style="text-align: left">

<center <strong>REPORTE ADOR</strong></center<br />

<asp:SiteMapPat h ID="smpMiSitio " runat="server" Font-Names="Verdana"
Font-Size="0.8em"

PathSeparator=" : ">

<PathSeparatorS tyle Font-Bold="True" ForeColor="#990 000" />

<CurrentNodeSty le ForeColor="#333 333" />

<NodeStyle Font-Bold="True" ForeColor="#990 000" />

<RootNodeStyl e Font-Bold="True" ForeColor="#FF8 000" />

</asp:SiteMapPath >

<br />

<br />

<asp:contentpla ceholder id="phContenido " runat="server">

</asp:contentplac eholder>

</div>

<br />

<strong><em><sp an style="text-decoration: underline">(C) Todos los derechos
reservados...</span></em></strong>

</form>

</body>

</html>

---------- codigo del archivo reporte.aspx

<%@ Page Language="VB" MasterPageFile= "~/Header.master"
AutoEventWireup ="false" CodeFile="Repor te.aspx.vb" Inherits="Repor te"
title="Reporte" %>

<asp:Content ID="Content1" ContentPlaceHol derID="phConten ido"
Runat="Server">

<asp:Label ID="lblEtiqueta " runat="server" Text="Label"></asp:Label>

<asp:DropDownLi st ID="DropDownLis t1" runat="server" AutoPostBack="T rue">

<asp:ListItem>h ola</asp:ListItem>

<asp:ListItem>c ompa</asp:ListItem>

</asp:DropDownLis t>

</asp:Content>

--------- codigo del archivo reporte.aspx.vb

Partial Class Reporte

Inherits System.Web.UI.P age

Protected Sub DropDownList1_S electedIndexCha nged(ByVal sender As Object,
ByVal e As System.EventArg s) Handles DropDownList1.S electedIndexCha nged

Me.lblEtiqueta. Text = Me.DropDownList 1.SelectedItem. Text

End Sub

End Class

------------ codigo del archivo web.sitemap

<?xml version="1.0" encoding="utf-8" ?>

<siteMap xmlns="http://schemas.microso ft.com/AspNet/SiteMap-File-1.0" >

<siteMapNode url="Login.aspx " title="" description="Ac ceso al Sistema">

<siteMapNode url="Reporte.as px" title="Inicio" description="Re porte">

</siteMapNode>

</siteMapNode>

</siteMap>

--------codigo del archivo web.config

<?xml version="1.0"?>

<configuratio n>

<appSettings/>

<connectionStri ngs>

<add name="AConnecti onString" connectionStrin g="Data
Source=DBServer 001;Initial Catalog=DBVenta s;Persist Security Info=True;User
ID=sa;Password= sa;Connect Timeout=60" providerName="S ystem.Data.SqlC lient"/>

</connectionStrin gs>

<system.web>

<compilation debug="true" strict="true" explicit="true"/>

<pages>

<namespaces>

<clear/>

<add namespace="Syst em"/>

<add namespace="Syst em.Collections"/>

<add namespace="Syst em.Collections. Specialized"/>

<add namespace="Syst em.Configuratio n"/>

<add namespace="Syst em.Text"/>

<add namespace="Syst em.Text.Regular Expressions"/>

<add namespace="Syst em.Web"/>

<add namespace="Syst em.Web.Caching"/>

<add namespace="Syst em.Web.SessionS tate"/>

<add namespace="Syst em.Web.Security "/>

<add namespace="Syst em.Web.Profile"/>

<add namespace="Syst em.Web.UI"/>

<add namespace="Syst em.Web.UI.WebCo ntrols"/>

<add namespace="Syst em.Web.UI.WebCo ntrols.WebParts "/>

<add namespace="Syst em.Web.UI.HtmlC ontrols"/>

</namespaces>

</pages>

<authenticati on mode="Forms">

<forms loginUrl="Login .aspx" name=".rptcooki e" timeout="5" >

<!--protection="All " timeout="1">-->

</forms>

</authentication>
<authorizatio n>

<deny users="?"/>

</authorization>

<customErrors mode="Off"/>

</system.web>

</configuration>
Dec 8 '06 #1
0 2259

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1527
by: Jeff Lynch | last post by:
I need to call a class on every web page in a site. In ASP.NET 1.1 I would call this class before the Page_Load event in each web page's code-behind file since it needs to run before the web page loads. In ASP.NET 2.0 can I do the same thing by calling the class on the MasterPage's code-behind before it's Page_Load and will this run before the content page's Page_Load? -- Jeff Lynch
7
1959
by: Martijn Saly | last post by:
Hi there, I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage I've created StartDate and EndDate properties, which are basically wrappers around the SelectedDates property from the Calendar control. When I select another date in the Calendar, the page updates normally, but when Page_Load for the content page...
3
1780
by: Lars W. Andersen | last post by:
Hi, I am looking for a good - easy to comprehend little CMS application for my "beginners" asp.net 2.0 site. It must be able to use Access as the database (only a couple of people will be posting and editing news articles). I use masterpages so it needs to be able to publish content in the ContentPlaceholder server controls.
2
2467
by: iturner100 | last post by:
Hi, I've been struggling with this one for a couple of hours without much joy. Basically, I've got a set of nested masterpages (3 as it happens). I'm dynamically generating a new page in code and want to be able to populate the ContentPlaceholders of the inner-most masterpage at run-time.
5
4319
by: Nick Wouters | last post by:
Dear All In Classic ASP I used CSS for ALL layout. Now in ASP.NET version 2 I am testing out Masterpages as they come in very handy. It seems like it is replacing CSS for layout but what is the best choise? 1) Using Masterpages with Themes (css / images / skins included in this theme)
2
8296
by: encoad | last post by:
Hi everyone, I'm slowly going mad with Masterpages and the FindControl. After a couple days of figuring out how to use the FindControl command from within a Masterpage, I still can't explain why this code does not function. As you can see if you compile it with 2005, clicking "Button" will achieve the desired result of displaying the contents of the textbox, however the test(); function called from Page_Load does not do anything. ...
0
1246
by: Sergio E. | last post by:
Hello, I have a problem with masterpages and forms security. I made a new Web site, in which I have my page login.aspx as the homepage , a master page with only a sitemappath object in it, the file of map of the site, the web.config and another page to do tests. In the page redirected from login there are a label and a combo (dropdown)
6
1979
by: =?Utf-8?B?U3RlcGhlbiBIYXRmaWVsZA==?= | last post by:
I have two masterpages in a web application. One is used for the login and logout pages. The other is used for all other pages in the application. The difference between the two masterpages is that on the main one I have a user control in the left side that has the site navigation menu while the login/logout masterpage has a non-breaking space in that table cell. Everything else is exactly the same. The issue is that the login/logout...
8
11792
by: Mort Strom | last post by:
Right now the header of my master page contains all of the CSS styles for all of the pages that might be loaded in my ContentPlaceHolder. The problem is that my <styletag is getting too large to manage. I have 300 lines of styles in my masterpage and I don't need all of this for every page -- somehow this can't be a smart way of managing styles. How do I programmatically apply styles in my MasterPage based on the ContentPlaceHolder...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.