D
dustbort
I recently had a problem where my required field validator stopped working.
But, the page still posted back and tried to insert a record into the
database without performing server-side validation. I discovered that there
was no aspnet_client folder in the root of my IIS Web site, and when I ran
"aspnet_regiis -c", client-side validation was working again. However, what
I don't understand is why the required field validator did not validate on
the server.
I have a Button WebControl with CausesValidation = True and a
RequiredFieldValidator with EnableClientScript = True. I thought that
client-side validation provided a nice user experience and reduced
postbacks, but that server-side validation was ALWAYS performed.
Can someone explain why not having the aspnet_client folder would then cause
server-side validation to stop working???
Also, on my Windows 2000 Server SP4, the following javascript code is
emitted in the page in question (even after restoring aspnet_client):
-----------------------------------
if (typeof(clientInformation) != "undefined" &&
clientInformation.appName.indexOf("Explorer") != -1) {
if ((typeof(Page_ValidationVer) != "undefined") && (Page_ValidationVer
== "125"))
ValidatorOnLoad();
}
-----------------------------------
But on my windows XP Pro SP2 development machine, the following code is
emitted in this page:
-----------------------------------
if (typeof(clientInformation) != "undefined" &&
clientInformation.appName.indexOf("Explorer") != -1) {
if (typeof(Page_ValidationVer) == "undefined")
alert("Unable to find script library
'/aspnet_client/system_web/1_1_4322/WebUIValidation.js'. Try placing this
file manually, or reinstall by running 'aspnet_regiis -c'.");
else if (Page_ValidationVer != "125")
alert("This page uses an incorrect version of WebUIValidation.js.
The page expects version 125. The script library is " + Page_ValidationVer +
".");
else
ValidatorOnLoad();
}
-----------------------------------
If the Win2k server had emitted the checks and alert() lines, I would have
been able to find the cause of the problem much quicker. Does anyone know
what accounts for the difference and what I can do to get my server to emit
the second code fragment???
But, the page still posted back and tried to insert a record into the
database without performing server-side validation. I discovered that there
was no aspnet_client folder in the root of my IIS Web site, and when I ran
"aspnet_regiis -c", client-side validation was working again. However, what
I don't understand is why the required field validator did not validate on
the server.
I have a Button WebControl with CausesValidation = True and a
RequiredFieldValidator with EnableClientScript = True. I thought that
client-side validation provided a nice user experience and reduced
postbacks, but that server-side validation was ALWAYS performed.
Can someone explain why not having the aspnet_client folder would then cause
server-side validation to stop working???
Also, on my Windows 2000 Server SP4, the following javascript code is
emitted in the page in question (even after restoring aspnet_client):
-----------------------------------
if (typeof(clientInformation) != "undefined" &&
clientInformation.appName.indexOf("Explorer") != -1) {
if ((typeof(Page_ValidationVer) != "undefined") && (Page_ValidationVer
== "125"))
ValidatorOnLoad();
}
-----------------------------------
But on my windows XP Pro SP2 development machine, the following code is
emitted in this page:
-----------------------------------
if (typeof(clientInformation) != "undefined" &&
clientInformation.appName.indexOf("Explorer") != -1) {
if (typeof(Page_ValidationVer) == "undefined")
alert("Unable to find script library
'/aspnet_client/system_web/1_1_4322/WebUIValidation.js'. Try placing this
file manually, or reinstall by running 'aspnet_regiis -c'.");
else if (Page_ValidationVer != "125")
alert("This page uses an incorrect version of WebUIValidation.js.
The page expects version 125. The script library is " + Page_ValidationVer +
".");
else
ValidatorOnLoad();
}
-----------------------------------
If the Win2k server had emitted the checks and alert() lines, I would have
been able to find the cause of the problem much quicker. Does anyone know
what accounts for the difference and what I can do to get my server to emit
the second code fragment???