Showing posts with label microsoft. Show all posts
Showing posts with label microsoft. Show all posts

Wednesday, March 28, 2012

AJAX breaks URL rewriting : Microsoft JScript runtime error: Sys is undefined

Hey all,

My development machine is Windows XP. I'm using Intelligencia's URLRewriter.NET httpmodule to handle URL rewriting. I'm also using ScottGu's Form Control Adapter trick to catch postbacks.

Here's the problem - Sometimes, AJAX will fail. The controls inside the UpdatePanels will work. However, they will cause the whole page to refresh instead of just the area inside the UpdatePanels. This bug happens randomly. After days of working on this problem, I have not found a way to reproduce the bug. This has been very, very frustrating.

When I attach the Visual Studio debugger to IE, the page will break on this line :
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));

This is the error that I get :
Microsoft JScript runtime error: 'Sys' is undefined

When I try to debug the page in Firefox using the FireBug plugin, I get the five following errors :

I'll get three errors for the following line :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
One of those errors comes from WebResource.axd, and two of them come from ScriptResource.axd

I'll get a "Sys is not defined" error from my index.aspx, although FireBug apparently doesn't know which line is throwing the error.

Finally, I'll get a "Sys is not defined" error from this line in my index.aspx:
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));

I can solve the problem temporarily by disabling the UrlRewriter. There's a line in web.config that specifies when the URLRewriter should rewrite a URL. After I take this line out of the web.config, I'll reload a page on the site, and AJAX will be working fine again. I'll then put the line back in web.config, thus enabling the URLRewriter. AJAX will continue to work fine. In other words, by taking out the URLRewriter and putting it back in again, the problem will be solved until the next time it randomly happens again. Weird, huh?

If you have any insight at all into the nature of this problem, please let me know. Likewise, if you can tell me how to debug this monster, please let me know, as I am at an utter loss at this point.

I believe UrlRewriter allows you to add exclusions based on header data. If so, exclude any requests with the request header "X-MicrosoftAjax: Delta=true". That will prevent it from interfering with any partial postbacks.

Thanks for the advice! This bug has driven me *insane!* I swear, I must have spent at least 2 1/2 days on this thing.

Fortunately, I think I made a breakthrough today.

URLRewriter.NET requires that you specify which URLs to intercept. Naively, I had given it the following configuration :
<rewrite url="(.*)" to="${UrlTransformer($1)}" /
Basically, I had told it to intercept all incoming URLs. I think this was a mistake.

Somebody on a forum suggested that, if you get the "Sys is undefined" error, you should try to take the URL for the ScriptResource.axd file and paste it into your address bar and see what happens. When I did that, instead of being offered the opportunity to download ScriptResource.axd, I noticed that URLRewriter had picked up on the URL and was trying to do a rewrite! This could mean that IIS never properly received the request for ScriptResource.axd, and thus the client never recieved it. This would explain the JScript error and subsequent AJAX failure.

I went ahead and entered the following new configuration for URLRewriter :
<rewrite url="^(.*\.aspx)$" to="${UrlTransformer($1)}" />

So now, it's only picking up URLs that end in .aspx. So far, everything is working exactly as it should. However, I am hesitant to close the case on this for two reasons :

1) This bug has been incredibly hairy, and there have been a few other occasions where I was *sure* I had solved the problem. Thus I am hesitant to call it prematurely.
2) The incredibly random nature of the bug. This is really what made this bug so difficult; the fact that there was no reliable way to reproduce it. Even if I am correct about the cause of the bug, why in the world would it occur so randomly? I know that the browser will cache the ScriptResource.axd code. Could the bug's occurance coincide with the browsers' cache being flushed? Was this problem really more likely to occur when the network was slow, or was I just imagining things? Why would removing the line from the web.config and then replacing it again make a difference?

I may never know the answers to these questions.

In any case, thank you for your help. Your suggestion will be the first thing that I try if my current solution doesn't work.

AJAX Beta 2 - Could not load type Microsoft.Web.UI.UpdateProgress from assembly Microsoft.

Hi...

I'm experiencing a problem with the new AJAX Beta 2. When I try and put the UpdateProgess on a simple page, I get the below

Could not load type 'Microsoft.Web.UI.UpdateProgress' from assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.TypeLoadException: Could not load type 'Microsoft.Web.UI.UpdateProgress' from assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Source Error:

Line 13: </head>
Line 14: <body>
Line 15: <form id="form1" runat="server">
Line 16: <div>
Line 17:


Source File:C:\Inetpub\wwwroot\Auction\TEST.aspx Line:15

Stack Trace:

[TypeLoadException: Could not load type 'Microsoft.Web.UI.UpdateProgress' from assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
ASP.test_aspx.__BuildControlform1() in C:\Inetpub\wwwroot\Auction\TEST.aspx:15
ASP.test_aspx.__BuildControlTree(test_aspx __ctrl) in C:\Inetpub\wwwroot\Auction\TEST.aspx:1
ASP.test_aspx.FrameworkInitialize() in C:\Inetpub\wwwroot\Auction\TEST.aspx.vb:912307
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +40
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.test_aspx.ProcessRequest(HttpContext context) +29
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

For the below code

<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %
<%@dotnet.itags.org. Register Assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="Microsoft.Web.UI" TagPrefix="asp" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager id="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateProgress id="UpdateProgress1" runat="server">
<progresstemplate>
<IMG src="Template/loading.gif" /> Working ... <asp:Image id="LoadingImage" runat="server" ImageUrl="Template/loading.gif"></asp:Image>
</progresstemplate>
</asp:UpdateProgress>
<asp:UpdatePanel id="UpdatePanel1" runat="server">
</asp:UpdatePanel>
</div
</form>
</body>
</html>
Please can you help, this is driving me nuts...Wink

Thanks,
Clint

Clint,

Did you try to add the assemby reference to the web.config file? You don't need to register it in the page, and you don't need it in the BIN folder.
Also, it seems that your copy of the assembly is still Beta 1, have you uninstalled Beta 1 and, then, reinstalled Beta 2? That will install the correct assembly in the GAC.

Cheers,

Juan


Hi Juan, thanks for your help.

I've uninstalled the Beta 2 and reinstalled a fresh copy from the internet, and I've also deleted the files in the BIN directory and the reference in the .aspx page.
In addition, I've replaced my web.config with the one that is created from a new web project including AJAX (I've included it below) But I am still getting this error.

Server Error in '/Auction' Application.

Could not load type 'Microsoft.Web.UI.UpdateProgress' from assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.TypeLoadException: Could not load type 'Microsoft.Web.UI.UpdateProgress' from assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Source Error:

Line 8: </head>
Line 9: <body>
Line 10: <form id="form1" runat="server">
Line 11: <div>
Line 12: <asp:ScriptManager id="ScriptManager1" runat="server">


Source File:C:\Inetpub\wwwroot\Auction\Default2.aspx Line:10

Stack Trace:

[TypeLoadException: Could not load type 'Microsoft.Web.UI.UpdateProgress' from assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
ASP.default2_aspx.__BuildControlform1() in C:\Inetpub\wwwroot\Auction\Default2.aspx:10
ASP.default2_aspx.__BuildControlTree(default2_aspx __ctrl) in C:\Inetpub\wwwroot\Auction\Default2.aspx:1
ASP.default2_aspx.FrameworkInitialize() in C:\Inetpub\wwwroot\Auction\Default2.aspx.vb:912307
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +40
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default2_aspx.ProcessRequest(HttpContext context) +29
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


Here is my code...

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager id="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateProgress id="UpdateProgress1" runat="server">
<progresstemplate>
<IMG src="Template/loading.gif" /> Working ... <asp:Image id="LoadingImage" runat="server" ImageUrl="Template/loading.gif"></asp:Image>
</progresstemplate>
</asp:UpdateProgress>
<asp:UpdatePanel id="UpdatePanel1" runat="server">
</asp:UpdatePanel>
</div
</form>
</body>
</html>

And here is my new web.config

<configuration>
<configSections>
<sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="Microsoft.Web.Configuration.ScriptingSectionGroup, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="webServices" type="Microsoft.Web.Configuration.ScriptingWebServicesSectionGroup, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="Microsoft.Web.Configuration.ScriptingJsonSerializationSection, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
<section name="profileService" type="Microsoft.Web.Configuration.ScriptingProfileServiceSection, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
<section name="authenticationService" type="Microsoft.Web.Configuration.ScriptingAuthenticationServiceSection, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<connectionStrings>
<remove name="AuctionConnectionString"/>
<add name="AuctionConnectionString" connectionString="Data Source=ALEPPO;Initial Catalog=Auction;Persist Security Info=True;User ID=sa;Password=" providerName="System.Data.SqlClient"/>
<add name="SMSINTv2ConnectionString" connectionString="Data Source=ALEPPO;Initial Catalog=SMSINTv2;Persist Security Info=True;User ID=sa;Password=" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="asp" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
<tagMapping>
<add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="Microsoft.Web.UI.Compatibility.CompareValidator, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="Microsoft.Web.UI.Compatibility.CustomValidator, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="Microsoft.Web.UI.Compatibility.RangeValidator, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Microsoft.Web.UI.Compatibility.RegularExpressionValidator, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="Microsoft.Web.UI.Compatibility.RequiredFieldValidator, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="Microsoft.Web.UI.Compatibility.ValidationSummary, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</tagMapping>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
--><compilation debug="true">
<assemblies>
<add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="Microsoft.Web.Script.Services.ScriptHandlerFactory, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET" path="ScriptResource.axd" type="Microsoft.Web.Handlers.ScriptResourceHandler" validate="false"/>
</httpHandlers>
<httpModules>
<add name="WebResourceCompression" type="Microsoft.Web.Handlers.WebResourceCompressionModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptModule" type="Microsoft.Web.UI.ScriptModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
<microsoft.web>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--
<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--
<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in Atlas applications, you need to add each property name to the setProperties and
getProperties attributes. -->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
--></webServices>
</scripting>
</microsoft.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="Microsoft.Web.UI.ScriptModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="Microsoft.Web.Script.Services.ScriptHandlerFactory, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" verb="GET" path="ScriptResource.axd" type="Microsoft.Web.Handlers.ScriptResourceHandler"/>
</handlers>
</system.webServer>
</configuration>

Hi...

I've managed to fix it thanks ...

I tried creating a new project and copying the files across to it, and it worked!? Very Strange!?

Any Idea why this would be, even after I copied the entire now working project files back to the original folder that wasn't working, it still did not work??

Thanks for your help,
Clint


I don't know if this helps any or not, but I was originally getting the same error and this is how i resolved it:

*I should first mention I had Beta1 and the ValueAdd CTP implemented prior to Beta2. (I had implemented them simply by copying the Microsoft.Web.Extensions.dll and Microsoft.Web.Preview.dll to the app's Bin folder):

To implement Beta2 I followed the doc instructions (web.config modification), and deleted the 2 dll's from the Bin folder (and removed the web.config references to the ValueAdd piece).

That's when I started getting the same error you were.

UNTIL I restarted IIS. I'm guessing it (or ASP.NET) had the old dll's cached somewhere since I originally had them in the bin folder??

Hope it helps-

Kenneth


The assemblies are in the GAC, cached, etc. Restarting IIS as suggested below worked for me too.

AJAX Beginner HELP!!

I checked out the instructional videos provided on this site for the Microsoft AJAX but it is all for the ATLAS release.

Take for example here is some of the code that I have from one of the videos

<%

@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="false"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<%

@dotnet.itags.org.RegisterAssembly="Microsoft.Web.Atlas"Namespace="Microsoft.Web.UI"TagPrefix="atlas" %>

<%

@dotnet.itags.org.RegisterAssembly="AtlasControlToolkit"Namespace="AtlasControlToolkit"TagPrefix="atlastoolkit" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server">

<

atlas:ScriptManagerID="PageScriptManager"runat="server"EnablePartialRendering="True"/>

<

atlastoolkit:HoverMenuExtenderID="HoverMenuExtender1"runat="server"><atlastoolkit:HoverMenuPropertiesTargetControlID="btnProduct"PopupControlID="PanelPopUp"PopupPosition="Left"PopDelay="25"/></atlastoolkit:HoverMenuExtender>

<

title>Untitled Page</title>

<

styletype="text/css">

/*Hover Menu*/

.popupMenu

{position:absolute;visibility:hidden;background-image:url(images/header.png);opacity:.9;filter:alpha(opacity=90);

}

.popupHover

{background-image:url(images/header-opened.png);background-repeat:repeat-x;background-position:lefttop;background-color:#F5F7F8;

}

</

style>

</

head>

<

bodystyle="text-align: left"><formid="form1"runat="server"><br/><table><tr><tdstyle="width: 80px"><asp:PanelID="PanelPopUp"runat="server"Width="80"BackColor="white"CssClass="popupMenu"><asp:LinkButtonID="BtnUpdate"runat="server"CausesValidation="True"CommandName="Update"Text="Update"></asp:LinkButton> <br/><asp:LinkButtonID="BtnDelete"runat="server"CausesValidation="False"CommandName="Cancel"Text="Delete"></asp:LinkButton> </asp:Panel></td><tdstyle="width: 100px"><asp:LinkButtonID="btnProduct"runat="server"Width="273px">Product Number One</asp:LinkButton></td></tr></table></form>

</

body>

</

html>

Now the big issue is I just installed the new Beta 2 I do not have the ATLAS installed. I do not get any options for AJAX controls or code and I created a new website using the option for "ASP.NET AJAX-Enabled Web Site"

Please tell me what is going wrong do I need to uninstall and reinstall everything.

Also I am using the Visual Studio Express Web

Thank you for any help you can provide on this

hello.

1st, the ajax extensions have changed the prefix name used...there's a breaking change document which explains this on the ajax.asp.net site

you should also note that you need to download the toolkit pack from codeplex in order to use it...

Saturday, March 24, 2012

ajax and page_PreInit

Can someone please explain this to me.

Ive been trying to add some controls to a placeholder situated within a updatepanel.

According to microsoft i should create all dynamic controls in the page_preinit method. However when i did this the placeholder object was null.

When i moved the placeholder out of the updatepanel everything worked as expected

I moved the placeholder back into the updatepanel and moved the code to the page_preload method and i can now access the placeholder fine.

Im presuming that anything within an updatepanel cannot be access in the page_preiinit method, but can someone explain why.

Thanks in advance

Hi, I am having the same problem. Did you ever get an answer as to why this happens?

Thanks,

Steve

Wednesday, March 21, 2012

Ajax and Expression Web

Hi Guys,

Is it possible to add the Microsoft Ajax Framework to Expression web so that the controls show up in the Expression Web toolkit ?

If not is a version going to be availble for Expression web ?

Kind Regards

Andy

I would really like to know this as well. If Expression Web is the future of front-end web development, why can't I use the official ASP.Net AJAX components in my projects? Is there some other way to work with developers using Visual Studio 2005 and the new control toolkit?

Does anyone have any information on this?

I'd really like to know if this is possible. I'd agree that it is insane if not! I wish Microsoft would consolidate their web design/development products into one (preferably Visual Studio).

Thanks in advance.


I found this link about the topic http://blogs.msdn.com/andrewj/archive/2006/12/13/custom-asp-net-controls-and-expression-web.aspx , but it talks about using the GAC. Can someone from MS chime in and tell us if our controls must be in the GAC to use them in expression web?

Thanks,

Jon


You can access the ajax items in Expression provided the web.config is setup to use MS Ajax. What I did was create a project using the ajax web template (control or just ajax) in Visual Studio 2005 and then opened up that project in Expression. The issue is the tags are available in the 'code' view, but you get an error in 'designer' mode. You'll also see this if you build user controls that reference 3rd party controls (like the RAD controls). I have not been able to get the designer to use the controls without this error so I'm assuming the designer does not know about the 'referenced' dll objects.

If you don't have VS Studio or the Ajax template, you can manually add the ajax support -- but it is a bit of a pain...

-Don


Andy

Easiest way is to open up to explorer windows, one to where you install the ajaxcontroltoolkit.dll and the other to windows\assembly.

Drag and drop the ajaxcontroltoolkit.dll into the assembly folder.

Add the following to each page which references controls from the toolkit, best to double check the version and publickeytoken - you can see the values in the assembly folder.

<%@. Register
Assembly="AjaxControlToolkit, Version=1.0.10606.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"
Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %>


ToolkitScriptManager still can't display for some reason, I'll keep digging.

HTH

Rob


Thanks for that Rob, but why do we have to struggle to do it and why can Microsoft Visual Web Developer Express a free tool from Microsoft install the Ajax controls but the money costing Expression Web can't !!!

All I can say is . . . BRING ON THE NEXT VERSION OF EXPRESSION WEB . . . as the ability to add new controls easily is crucial, at the moment you have to build part in Expression Web and then open it in VWD Express to use Ajax, its just so annoying !!!


When I try to either drag n drop or copy/paste the system will not allow me to put the ajaxcontroltoolkit.dll into the Wndiows/Assembly directory.

There are seveal ajax controls I would like to use on my site but can not get them to work in Expression Web. We have just converted to using Expression Web for designing updates to our application. The tool is far superior to the old FrontPage but I am having some learning pain when trying to step up to ASP.NET and learn how to use it.


Has there been any progress made on this issue? I googled it a bit but didn't turn up too much.

I have just installed Expression Web and I am a bit hesitant to use it because the site I am currently designing makes heavy use of AJAX controls.

I did read a few things about using custom ASP.NET controls in Expression. About using GAC and editting your web.config. Will these same techniques allow Expression Web to fully integrate AJAX controls?

http://blogs.msdn.com/andrewj/archive/2006/12/13/custom-asp-net-controls-and-expression-web.aspx


So I got everything working. I figured I'd explain how for future viewers.

This is how you get Ajax and the AjaxControlToolkit working in Expression Web (code view w/ intellisense and design view with properties).

STEP 1 - In your sites web.config file you must have the following:

<system.web>
<pages>
<controls>
<addtagPrefix="asp"namespace="System.Web.UI"assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<addtagPrefix="ajaxToolkit"namespace="AjaxControlToolkit"assembly="AjaxControlToolkit, Version=1.0.10920.16768, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
</controls>
</pages>

<compilationdebug="true">
<assemblies>
<addassembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<addassembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<addassembly="AjaxControlToolkit, Version=1.0.10920.16768, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
</assemblies>
</compilation>
</system.web>

NOTE: The assmebly version and keys may vary depending on what version of the toolkit you have installed. These are simple enough to find in the sample website for the AjaxControlToolkit's web.config.

NOTE: Since the AjaxControlToolkit is referenced in the web.config you do not need to include <%@. Register Assembly... %> on each of your pages.

STEP 2 - Add the AjaxControlToolkit.dll to your site's bin folder.

STEP 3 - Add the AjaxControlToolkit.dll to GAC

This is simple. Open the Visual Studio Command Prompt (from Start menu) and navigate to the bin folder of your site and type d:\> gacutil /i AjaxControlToolkit.dll

Now open your site in Expression Web and everything should be working!


One thing I would like to add...

The line in <assemblies> for the AjaxControlToolkit has version info and a publicKeyToken that cannot be found in the web.config of the sample website and it will vary depending on the version of the Toolkit you have installed.

To find this info you can either write a small program (1 line of code really) or just put the following line into a Watch while you are debugging something:

System.Reflection.Assembly.LoadFile(@."[PathToAjaxControlToolkit]\SampleWebSite\Bin\AjaxControlToolkit.dll").FullName

This will give you the text to put in the assembly attribute for the <add assembly=""/> line.

The file you reference here must be the same one you add to the GAC.



Oh won't some kind soul come and mark my post as the answer?


Yeah, I had a problem getting that going too. A quick powershell script handed the info over for me. I guess Reflector would produce the same result as well.

PowerShell script:

$assembly = [System.Reflection.Assembly]::LoadFile("path\to\AjaxControlToolkit.dll")
$name = $assembly.GetName()
"<SafeControl Assembly=""{0}"" Namespace=""{1}"" TypeName=""*"" />" -f $assembly.FullName,$assembly.GetName().Name

Output:

<SafeControl Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" Namespace="AjaxControlToolkit" TypeName="*" />

AJAX and AJAX Control Toolkit deploying to production

Hi,

We have a web site that has been built using ASP.NET, Microsoft AJAX, and the AJAX Control Toolkit.

Question:

Is there anything we should do before we move the web site to the production servers? For example, in ASP.NET, we need to change the debug="true" to "false" on the web.config. Is there anything similar that we need to do for AJAX and the toolkit?

Thank you

I'm not an ajax.asp.net expert, the next has been enough for me:

Ajax.asp.net extensions 1.0 must be installed on production server. You can download from here http://go.microsoft.com/fwlink/?LinkID=77296

No modifications required for the control toolkit. The binaries (dlls) are included inside Bin folder in solution when toolkit was added to solution. Check if they are present.

I recommend publish your web site with the utility "public website" from VS2005, if it's possible for you.

Hope this can help you.

Miguel Tomico.