Monday, March 26, 2012

AJAX Toolkit not working with Masterpages when retrofitting to exsiting website and what i

I have posted to these two threads with no response

http://forums.asp.net/p/1096452/1761461.aspx#1761461

http://forums.asp.net/p/1037436/1760268.aspx#1760268

Please scroll to the bottom of those threads for more details, but in a nutshell I must be having a different problem than there's as they seem to have all had problems with beta versions and I am on VS 2005 SP 1 and AJAX 1.0.

I have no problem creating a new AJAX enabled web site and getting it to recognize and use the controls, but when I try to AJAXify an exisiting website the toolkit does not work. If I only add script manager and a panel, I get no errors, but then if I try to add any of the extenders from the toolkit, the project won't even compile - get the squiggly lines underneath the control, but I still have intellisense in the update panel, but not the calendar extender, which it claims is not a known element.

With Master Pages, where do you put the script manager, in the Master page, or the child pages?

Notes below are added after the original post

OK, I created a new AJAX enabled web site from scratch and then added a master sheet, deleted everything except the following from my default page after wiring the MAsterPAgeFile reference

<%@dotnet.itags.org.PageLanguage="VB"MasterPageFile="~/MasterPage.master"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

then I added a script manager, and then a textbox and calendar extender inside an update panel, and ran the debugger. Right away it popped up a dialog box wanting to know where the ExtenderControlBase.cs file was, and so I browsed to it in the subsequent ASP and then AJAX directories, found it and then ran this project and it worked fine. Problem is I didn't need to find and browse for that ExtenderControlBase.cs file to get this project to work before I added master pages..?? And why does it continue to work eventhough I have since removed that file from the project?

Nevertheless it still does not work in my original website that has far too much work put into it to try and start over from scratch. This is the error I am getting:

Error 1 Element 'CalendarExtender' is not a known element. This can occur if there is a compilation error in the Web site.

and I get

Error 34 Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


usually people don't like to reply because: some people post too much information that readers do not want to go over everything ... time is valuable. if you can make it short and precise then you will get more help.

...

do you have your AjaxControlToolkit.dll inside your bin?
From your other threads, you said that when you create a new ajax site it works, but your existing website with ajax doesn't work? May be you didn't copy the web.config file correctly.

if you want to add ajax to a non-ajax website; first, you create a new ajax site and copy the web.config file over to your old website. be sure to back up your old config file and move over the data that you need to the new config file. Good luck ......


Thanks for replying Wishstar,

Yes, I have taken over a web.config just as you said. I did it twice. The only diff in the web.config is that the old one had a connection string. I went along step for step with the video tutorial. And yes AjaxControlToolkit.dll is inside my bin.

The only other apparent differences is that my exisiting website has Sql dataset connections, and is also being developed on a remote machine, but the VS 2005 and all my AJAX stuff is on my local machine, but my source code and database is on a remote machine. Everything has worked fine up until now.

It seems nothing in the toolkit is recognized. I also tried reregistering (re-adding a reference to) the dll, and it even recognized that it was already registered and warned it would be overwritten.


sorry ...accidentally double posted


does anything run on your system at all? any of the samples from the toolkit? Try running it on your dev machine. if you are able to run the samples, that means there must be something wrong with your work.


OK solved part of problem found MUCH BIGGER PROBLEM

Sorry I haven't responded for two days, but I was on jury duty and just got back to debugging this problem.

I ruled out my coding as the problem by taking my code from the working exisiting web site and using the Visual Studio copy web site tool, copied the develoment files to an AJAX toolkit enabled website that I juts created on my local machine.

All extenders started working and intellisense returned UNTIL I WENT TO PUBLISH TO THE REMOTE MACHINE.

The publishing went apparently fine until I went to pull up the web site ...I got a cryptic error and then remote desktopped into that machine and ran the local host to get a more verbose explanation of the error.

It seems that it does not like anything to do with the System.Web.Extensions or System.WebServer. I had to remove all the AJAX stuff and line by line comment out these lines from my web.config and rebuild before my website was working again...PHHHEWWW (I got a demonstartion meeting this afternoon and people will want to review my site between lunch and the meeting - I told them to).

The following is a screen of the error I got while running the local host...what do I have to do to the remote host running IIS to get it to allow me to run AJAX on it?

Thanks, Earl

Server Error in '/' Application.

Configuration Error

Description:An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message:Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (c:\inetpub\wwwroot\web.config line 52)

Source Error:

Line 50: </httpHandlers>Line 51: <httpModules>Line 52: <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>Line 53: </httpModules>Line 54: <!--


Source File:c:\inetpub\wwwroot\web.config Line:52

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210


did you install ajax on your server?


OK, paint me stupid...am I supposed to install AJAX on my server too? I'm confused, I thought AJAX toolkit was a set of controls that generated script. I guess I am thinking way too much like the VB6 hack that I am (guilty as charged) and controls are just like ocx's.

Ok, so do I install AJAX toolkit? AJAX normal that came with the script manager, er?


OK problem solved...at least so far. This is what I posted in this other threadhttp://forums.asp.net/t/1072841.aspx?PageIndex=2

On my development machine, I clicked on the .Bin folder and then clicked on Add Item, and NOT Add Reference. I then browsed to the folder where ASP.Net extensions folder and then clicked the folder of my version number v1.0.61025 and NOT the AJAX Control Toolkit. In that version numbered folder you find the System.Web.Extensions.dll. The dll now appears under the Bin folder. I merely published to my remote (nearby Windows 2000 SP4, .Net Framework 2.0, IIS 5.0 or 5.1? box) webserver (intranet).

Now, my only question, am I running the minimum configuration to allow the ASP AJAX services? Also, was I oblivious to this trust issue. As I understand a host (other than intranet?) has to support AJAX, but it seems I got around that issue?


Hi,

FYI

Just keep in mind when you want to host your application make sure that your hosing company support ajax as well. I had this promblem and I had to ask them to install the framwork on their server.


Lucky for me I'm just an Intranet kinda guy, but I imagine some day I will be on the Internet, and I'll have to learn this all over again. BTB I am on a LAN and using a Windows 2000 SP4 server running IIS 5.0 with a 'shadow' IT group (yep, they really call it that) and I may have to move it to the official IT group (dark side, black helicopters), and I don't think they are AJAXified or willing either.


I have this similiar issues. I installed AJAX on my local machine. I have to create a reomote project, I can't install AJAX on the reomote Server because I'm not allow. But I did, copy all the .dll related to AJAX and AJAX control and the Web.config has all the stuff need. When I build the project I get erros on every control that I'm using, sample "Element CalendarExtender is not a known element" If I go to the http link, everything seams to work fine, but I can build the project because of the elements errors.

How can I fix this issue?

Thanks


Please look at my answers above, and then follow the link in my response as to how I solved the issue.

If your issue is that you cannot install AJAX because you are publishing to an ISP (commercial third party Internet Service Provider) then you need to ask them to install it, and they should comply, most people are doing this.

If you are publishing on an Intranet or a captive network for lack of better terms, then you will probably at least need to get administrative rights on that server and then publish while properly referencing the AJAX toolkits, and the System.Web.Extensions.


It's on an Intranet and they will not install anything and they wouldn't give us Administrative rights. I was trying to work around the issue by adding the System.Web.Extensions.dll and AJAXControlToolkit.dll to the bin folder. Sad

Thanks


How do you publish to it normally?

No comments:

Post a Comment