473,545 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

forms security problem


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
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
one has The problem is that it again redirects me to the login page, i singn
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

Thanking for beforehand your time and help.
Sergio E.
---------code: 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>




--- code: login.aspx.vb (cookie definition only)

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

-------------- code: header.master

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




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


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

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




--------code: 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 22 '06 #1
0 1231

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

Similar topics

by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms Authentication set up and it worked just fine. Then I realized that I needed to have some pages unsecure. I then created 2 directories. One named Secure and...
by: Stephan Neuhaus | last post by:
Hi all. I'm having a problem that's driving me nuts. I am not familiar with Access, but I have read the FAQ, searched google, read the Access Security FAQ, and looked at the Access Web, to no avail. Briefly, the problem is this: I'm having an old Access 2.0 database that I want to convert to Access 2000 on a different computer. The...
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be protected by forms authentication. When I create forms authentication at root level it works but when I move my code up to the subfolder I get this...
by: Martin | last post by:
Dear fellow ASP.NET programmer, I stared using forms authentication and temporarily used a <credentials> tag in web.config. After I got it working I realized this wasn't really practical. I cannot write to web.config so I cannot dynamically update the credentials while the site is up. Since the FormsAuthentication.Authenticate() method's...
by: Manny Chohan | last post by:
I am using forms authetication in the web config. i can validate a user against a database and click on images which makes hidden panels visible.However when i click on the link inside a panel which should take user to another pages, it defaults them back to the login page prompting them to enter username and password. Could someone please...
by: Tdar | last post by:
Sorry for the dup post but looking for a response and this is being posted under my MSDN managed newsgroups handle and in a different newsgroup Hi, As I said in the past post I am using this Article http://msdn.microsoft.com/security/default.aspx?pull=/library/en-us/dnpag2/html/paght000026.asp I belive i have everthing all set but I get...
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the...
by: gxl034000 | last post by:
Hi, I have been trying to use a .net Forms control in my webpage to open up an application(notepad) on the client. The control works fine when embedded in a windows form, but I keep getting a security exception when trying to run it from my webpage on my intranet. I have tried playing with the Code Access Security settings, but I can't get it...
by: Bouzy | last post by:
Hello I am having a problem with forms. I know they are easy for some people, but I am new. I am trying to make a simple feedback form. Hear is what I have so far... <?php //process the email if (array_key_exists('send', $_POST)) { $to = 'goldfishgraphics@gmail.com'; //use your own email $subject = 'Project Idea'; //process the...
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...
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. ...
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...
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...
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...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 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.