473,834 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with masterpages and security


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
the web.config and another page to do tests.
In the page redirected from login there are a label and a combo (dropdown)
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

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


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



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


<td style="width: 188px">



<td style="width: 199px">

<asp:TextBox ID="TxtUsuario " runat="server"



<td style="width: 188px">


<td style="width: 199px">

<asp:TextBox ID="TxtPwd" runat="server" TextMode="Passw ord"



<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>




--- 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 = ""


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>



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

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>


<br />

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




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

<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>


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




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

<?xml version="1.0"?>

<configuratio n>


<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>


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




<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"/>



<authenticati on mode="Forms">

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

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


<authorizatio n>

<deny users="?"/>


<customErrors mode="Off"/>


Dec 8 '06 #1
0 2261

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

Similar topics

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
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...
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.
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.
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)
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. ...
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)
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...
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...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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...
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,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.