473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.dtd">

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

<head runat="server">

<title>Login</title>

<link href="Styles/MiStyleSheet.css" 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="Reporteador"></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="Password"
Width="150px"></asp:TextBox></td>

</tr>

</table>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TxtUsuario"

Display="None" ErrorMessage="El campo Usuario no debe estar
vacío."></asp:RequiredFieldValidator>

<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TxtPwd"

Display="None" ErrorMessage="El campo Clave no debe estar
vacío."></asp:RequiredFieldValidator><br />

<asp:ValidationSummary ID="ResumenValidacion" runat="server" Height="85px"
ShowMessageBox="True"

ShowSummary="False" 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.EventArgs) Handles BtnLogin.Click

dim bUsuarioValido as boolean = ValidaUsuarioEnBDD() '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.Visible = True

Me.TxtUsuario.Text = ""

Me.TxtPwd.Text = ""

Else

FormsAuthentication.SetAuthCookie(Me.TxtUsuario.Te xt, True)

Session.Add(VariablesGlobales.NombreVarSesionEstad oAutorizado,
VariablesGlobales.ValorEsperadoSesionEstadoAutoriz ado)

Server.Transfer(NomPaginaOk,True)

End If

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

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

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

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

<head runat="server">

<title>Reporte</title>

</head>

<body>

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

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

<center <strong>REPORTEADOR</strong></center<br />

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

PathSeparator=" : ">

<PathSeparatorStyle Font-Bold="True" ForeColor="#990000" />

<CurrentNodeStyle ForeColor="#333333" />

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

<RootNodeStyle Font-Bold="True" ForeColor="#FF8000" />

</asp:SiteMapPath>

<br />

<br />

<asp:contentplaceholder id="phContenido" runat="server">

</asp:contentplaceholder>

</div>

<br />

<strong><em><span 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="Reporte.aspx.vb" Inherits="Reporte"
title="Reporte" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phContenido"
Runat="Server">

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

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">

<asp:ListItem>hola</asp:ListItem>

<asp:ListItem>compa</asp:ListItem>

</asp:DropDownList>

</asp:Content>

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

Partial Class Reporte

Inherits System.Web.UI.Page

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged

Me.lblEtiqueta.Text = Me.DropDownList1.SelectedItem.Text

End Sub

End Class

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

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

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

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

<siteMapNode url="Reporte.aspx" title="Inicio" description="Reporte">

</siteMapNode>

</siteMapNode>

</siteMap>

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

<?xml version="1.0"?>

<configuration>

<appSettings/>

<connectionStrings>

<add name="AConnectionString" connectionString="Data
Source=DBServer001;Initial Catalog=DBVentas;Persist Security Info=True;User
ID=sa;Password=sa;Connect Timeout=60" providerName="System.Data.SqlClient"/>

</connectionStrings>

<system.web>

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

<pages>

<namespaces>

<clear/>

<add namespace="System"/>

<add namespace="System.Collections"/>

<add namespace="System.Collections.Specialized"/>

<add namespace="System.Configuration"/>

<add namespace="System.Text"/>

<add namespace="System.Text.RegularExpressions"/>

<add namespace="System.Web"/>

<add namespace="System.Web.Caching"/>

<add namespace="System.Web.SessionState"/>

<add namespace="System.Web.Security"/>

<add namespace="System.Web.Profile"/>

<add namespace="System.Web.UI"/>

<add namespace="System.Web.UI.WebControls"/>

<add namespace="System.Web.UI.WebControls.WebParts"/>

<add namespace="System.Web.UI.HtmlControls"/>

</namespaces>

</pages>

<authentication mode="Forms">

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

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

</forms>

</authentication>
<authorization>

<deny users="?"/>

</authorization>

<customErrors mode="Off"/>

</system.web>

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

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

Similar topics

4
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...
7
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...
3
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...
2
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...
5
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...
2
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...
0
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...
6
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...
8
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.