RequiredFieldValidator and the SummaryValidator not working properly on IIS6 but they are on XP, huh

  • Thread starter Thread starter Flip
  • Start date Start date
F

Flip

When I'm developing my Guestbook application, the validator controls from MS
work properly on my XP box. But after I compile the project in release mode
(same happens in debug) and copy it to my IIS6 (win2k3 server box), the
validator controls let the errors through and the button click events fire
to save the data, erroneously I might add. Any ideas on why this is
happening?

Thanks.
 
I've narrowed down the code sample to use. I've cut'n'paste the code from
VS, so it's a bit wonky, sorry, but I hope it'll give you an idea I'm not
doing anything funky. Please don't tell me it's an IIS6 validator control
handling bug. I left j2ee to get away from that crap with different
solutions on different platforms. :< But it's looking like it works with
IIS under XP and behaves differently (broken) under win2k3server and IIS6.
Any ideas are greatly appreciated. Thanks.


Here's the html

<%@ Page language="c#" Codebehind="test.aspx.cs" AutoEventWireup="false"
Inherits="PCHenry.test" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>test</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<P><asp:Label id="Label1" runat="server">Label</asp:Label><asp:TextBox
id="TextBox1" runat="server"></asp:TextBox><asp:RequiredFieldValidator
id="RequiredFieldValidator1" runat="server"
ErrorMessage="RequiredFieldValidator"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator><asp:Button
id="Button1" runat="server" Text="Button"></asp:Button></P>
<P>&nbsp;</P>
<P><asp:Label id="Label2" runat="server">Label</asp:Label></P>
</form>
</body>
</HTML>


And here's the C# codebehind

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace PCHenry
{
/// <summary>
/// Summary description for test.
/// </summary>
public class test : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label2;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
Label2.Text = TextBox1.Text;
if( TextBox1.Text == null )
{
Label2.Text = "<NULL>";
}
else if( TextBox1.Text == "")
{
Label2.Text = "<empty>";
}
Label2.Text += ", RequiredFieldValidator1.IsValid=" +
RequiredFieldValidator1.IsValid;
}
}
}
 
Ok, I figured out I was missing the Page.IsValid check. HOWEVER, that
doesn't explain the different behaviour between IIS5 and IIS6, why the
differences?

Now that I have the Page.IsValid check properly done, on IIS6 I'm not
getting the client side message telling me what fields are missing like I do
when I'm on IIS5. Any ideas?
 
Back
Top