Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

AJAX client script bug with validator

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew Jocelyn - 10 Feb 2008 22:40 GMT
Hi

I'm getting a Javascript error when I move my development application to a
production server. I have an page with an UpdatePanel and a RadioButton
which switches between a TextBox or a FileUpload control both with
validators. On the development server the validators work correctly but when
I move the app to a production server the validators don't behave correctly.
The button click event incorrectly fires the validator for the TextBox
control when the UpdatePanel has switched to the FileUpload control.

The script error is

'null' is null or not an object.

which is raised here (>>>):

function ValidatorGetValue(id) {
var control;
control = document.getElementById(id);
>>>if (typeof(control.value) == "string") {
return control.value;
}
return ValidatorGetValueRecursive(control);
}

I notice that the production web page has missing Javascript. The
development version renders a script block with
Sys.Application.initialize(); and additional script like this:

document.getElementById('ctl00_ContentPlaceHolder1_TitleRequiredFieldValidator1').dispose
= function() {
   Array.remove(Page_Validators,
document.getElementById('ctl00_ContentPlaceHolder1_TitleRequiredFieldValidator1'));
}

These 'document.getElementById...' lines for the page validators are missing
from the production version.

I have carefully checked that the web.config file contains the same config
sections and httpmodules etc.

It seems that the production server must have something missing or
incorrectly configured but I'm not sure what this can be. Please let me know
what I can do to fix it.

Many thanks
Andrew
Walter Wang [MSFT] - 11 Feb 2008 01:40 GMT
Hi Andrew,

I suggest use Fiddler (http://www.fiddlertool.com/) to trace the requests
to the web site on your production server, it may help us to know if
there's any scripts failed to download to client.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Andrew Jocelyn - 11 Feb 2008 10:47 GMT
Hi Walter

I've installed Fiddler and checked the responses. A request successfully
downloads these resources.

http://.../ScriptResource.axd?d=p54NJ7GHFfdhGtBCXOMTN8zT53hYfJlPzqqb9GFBSv0alfxiWSvqeCoXVoeMUtT80&t=633382414949993750

http://.../ScriptResource.axd?d=p54NJ7GHFfdhGtBCXOMTN8zT53hYfJlPzqqb9GFBSv0yZA1yoFwTQgxP1SdSeeasOAIDYPFoHrH0pU1FJ5WGbA2&t=633382414949993750

However, the problem seems to be that the application is not rendering the
script blocks in the aspx page the same as it is on the development machine.
So the server-side code behaves differently on the production server
compared to the development machine. The only difference I know of between
the 2 servers it that the System.Web.Extensions.dll is registered with the
GAC on the dev machine but is copied to the BIN folder on the production
server. Also the production server has never had any previous versions of
AJAX related dlls installed.

Any ideas?

Thanks
Andrew
marss - 11 Feb 2008 12:22 GMT
>The only difference I know of between
> the 2 servers it that the System.Web.Extensions.dll is registered with the
> GAC on the dev machine but is copied to the BIN folder on the production
> server. Also the production server has never had any previous versions of
> AJAX related dlls installed.

Just a few assumptions without pretension to strict accuracy :)

In web.config you set reference for file the System.Web.Extensions.dll
as
<assemblies>
   <add assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>

It works fine if you have this dll installed in GAC because it is
installed in "v1.0.61025" folder and it is considered as a file
version. But on your development server the application looks through
its Bin folder and finds file System.Web.Extensions.dll which file
version is ...  1.0.61231.0 (it is the real file version for this
dll).

Possible solutions:
1. Change reference for the dll from GAC to a local file in Bin folder
and recompile the project.
2. Remove additional info from web.config, just leave <add
assembly="System.Web.Extensions"/>
I don't even know what is worse :)

It is just an assumption, I am not sure whether I am right.

Regards,
Mykola
http://marss.co.ua - Casual ideas for web development
Andrew Jocelyn - 11 Feb 2008 14:53 GMT
Hi

Thanks for your suggestions. Actually, I have now installed the
System.Web.Extensions into the GAC on the
production server.

The problem remained. I checked to see what windows updates were available
and saw there is a .Net Framework 2.0 SP1. I've installed it and now the
application on the production server works correctly.

The release notes for ASP.NET 2.0 AJAX Extensions don't say that you need to
install this service pack, only Visual Studio 2005 SP1, which you obviously
don't install on a production server.

Oh well, it's working now.
Thanks
Andrew

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.