Welcome to Tech-Review.Org Sign in | Join | Help

.net_2.0

My coding blog entries. Typically will either be more complex coding examples or overcoming product issues / troubleshooting resolutions.
MSFT AjaxToolKit: Bizarre DynamicServicePath - well Path Issue AND SOLUTION

In trying to troubleshoot my issues with the migration I noted that for the sample ModalPopUp example with the toolkit automatically populates the DynamicServicePath.  I don't declare it explicitly in my ascx file it is auto-generated. 

 

The issue I have is the ToolKit Example if using the quick and easy Master Page Website deal - it is populated with the full path.  When you use a .Net application that generates urls dynamically - then it defaults to the root of the website...

 

Examples:

From the toolkit example (Beta release ) 

Sys.Application.add_init(function() {
    $create(AjaxControlToolkit.ModalPopupBehavior, {"BackgroundCssClass":"modalBackground","CancelControlID":"ctl00_ContentPlaceHolder1_CancelButton","DropShadow":true,"DynamicServicePath":"/test/ModalPopup/ModalPopup.aspx","id":"ctl00_ContentPlaceHolder1_ModalPopupExtender","OkControlID":"ctl00_ContentPlaceHolder1_OkButton","OnOkScript":"onOk()","PopupControlID":"ctl00_ContentPlaceHolder1_Panel1"}, null, null, $get('ctl00_ContentPlaceHolder1_LinkButton1'));
});

 

In my application - all of my urls are dynamically served... and so for instance for this page url: /localhost/SitesEasyTest/admin/EditNamedPages/default.aspx

The following gets generated:

Sys.Application.add_init(function() {

$create(AjaxControlToolkit.ModalPopupBehavior, {"BackgroundCssClass":"modalBackground","DropShadow":true,"DynamicServicePath":"/SitesEasyTest/default.aspx","id":"PopUp","PopupControlID":"ctl00_ctl00_ctl00_PanelModal"}, null, null, $get('ctl00_ctl00_ctl00_Target'));

It is not grabbing the actual url that it should.     In the ModalPopUp example and in my own code the DynamicServicePath is not declared it is added by the toolkit at runtime....

I attempted to correct the value via code behind:

MyPopUp = (ModalPopupExtender)GetOptionalControl(skin, "MyPopUp");

MyPopUp.DynamicServicePath = (CommunityGlobals.CalculatePath("Default.aspx")); // properly generates relative path url to the dynamic page

However, the following error is displayed when compiled and tested in a browser:

 

DynamicControlID must be set

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.ArgumentException: DynamicControlID must be set



[ArgumentException: DynamicControlID must be set]
   AjaxControlToolkit.DynamicPopulateExtenderControlBase.EnsureValid() +372
   AjaxControlToolkit.ExtenderControlBase.GetScriptDescriptors(Control targetControl) +98
   Microsoft.Web.UI.ExtenderControl.Microsoft.Web.UI.IExtenderControl.GetScriptDescriptors(Control targetControl) +7
   Microsoft.Web.UI.ScriptControlManager.RegisterScriptsForExtenderControls() +187
   Microsoft.Web.UI.ScriptManager.OnPreRender(EventArgs e) +402
   System.Web.UI.Control.PreRenderRecursiveInternal() +77
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

In either case - the script generated does not generate a DynamicControlID by defaultand so it is puzzling why trying to 'correct' what is incorrect by ovveriding the value - would cause the error?

 

Does the DynamicServicePath have any purpose if you are not using the dynamic population feature? Otherwise can chalk this up as being a potential issue down the road if I start to use the dynamicservices features....

 

While overall, this doesn't really impact me, it does pose two questions:

 

1.  Why is it being added to begin with?

2. Why isn't it picking up the proper url considering that all this stuff supposedly gets 'connected' in the pre-render phase of the page life cycle...

 

Well, after digging around the Toolkit source - I discovered the issue was actually in the ServicePathConverter.cs.  The way they define the path is using:

 HttpContext.Current.Request.FilePath. 

 

That is all fine and dandy and if your site is strictly based on the file system and not dynamically rendered from the database, this will work.  However, for those of us whom have URL remapping - the actual correct method to obtain the url is using: 

HttpContext.Current.Request.RawUrl

RawUrl() will allow those using both, either or File Systems or Database served requests.

 

Just change it in your ServicePathConverter.cs - recompile the toolkit to implement the fix until or if this is changed in any subsequent releases of the toolkit.

 

 

Posted: Monday, October 23, 2006 11:03 PM by Jody

Comments

Richard M said:

Awesome!  Just the fix I was looking for. :)

# November 22, 2006 9:10 PM

Jody said:

Pleased to state that Shawn Burke has fixed this and the change will be in the next release after Thanksgiving...

# November 23, 2006 12:13 AM

ASP.NET AJAX Forum Posts said:

Using Ajax 1.0 RC I’m getting this error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown

# December 27, 2006 3:41 PM

R. J. Souchak said:

I keep getting this error message on my computer.  And I'm not familiar with the codes above.  How would I be able to fix this error?

Sys.WebForms.PageRequestManagersServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404

Thank you for taking the time!

# March 20, 2007 12:21 PM

Rohit said:

HI I am also getting the same error,I am using URl rewriting.

# May 30, 2007 12:26 AM

Ramesh Babu said:

Dear friends,

I developed a site using ASP.NET AJAX for ASP.NET 2.0.But at localhost it works fine.After precompiling and after hosted in the server it gives problem.

I write code in Image Button click Event.

Image Button is in UpdatePanel

After Button is clicked the specified code is executed and required action is performed.But Error Message is appearing

The Error Message is

Sys.Webforms. PageRequestManag erServerErrorExc eption: An uknown error occurred while processing the request on the server.  The status code returned from the server was: 500

Please give your valueble solutions for this problem

Please

-Regards,

Ramesh Babu

# September 19, 2007 11:54 PM

Hemant said:

Dear friends,

I getting this error message on my computer. When i click on edit CommandField's image button.

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processiong the request on the server. The status code returned from the server was: 500

Please give your valueble solutions for this problem

Please

Regards,

Hemant Nagar

# January 23, 2008 5:17 AM

windows dvd decoders said:

I understand that there are special reasons why you may want to become a C programmer. If you want to become a video game developer and develop computation intensive rendering algorithms (click here to read about rendering on Wikipedia) or develop device

# July 1, 2008 3:22 AM

free dvd decrypt software said:

Many processes run under the name“ SVCHOST. EXE” and when it has problems, it’ s difficult to track down the cause. Examples of problems include system hangs or 100% CPU utilization that is attributed to the service. The performance team of Microsoft

# July 1, 2008 5:10 AM

www.copydvdwizard.com said:

Barcodes can be read by optical scanners called barcode scanners or barcode readers. In the UK and elsewhere, barcodes are placed on items in order to store or track information about them. Barcodes are widely used to implement AIDC (Auto ID Data Capture)

# July 2, 2008 1:02 AM

www.dvddecrypterpro.com said:

When my clients ask me if there is anything they can do to tweak the performance of their internet connections to speed up web browsing, this is the first trick of the trade that I show them. They’ re always pleased with the results, especially for the

# July 2, 2008 4:22 AM

how record dvd said:

“ There are a few things to look at when your computer is running slow. some can be hardware and some can be software, and some can be the person who is sitting at your desk right now. Let’ s go ahead and check a few things. I find it easier to start

# July 2, 2008 6:26 AM

dvdshrink said:

If you use your PC for work, don’ t use it for play, or allow family members to use it for play. Personal experiences show that the most common ways viruses, spyware, and other bad stuff gets on people’ s PC’ s is through“ play” stuff. This includes downloaded

# July 2, 2008 7:22 AM

free dvd burning software said:

Fall back to GetProcAddress entry in another DLL version.

# July 3, 2008 2:06 PM

dvd coping said:

Recent News OS X Curmudgeon? Me? Not By Design Or Intent Test Driving The Firefox 3 Beta 4 Browser Applelinks Tech Web Reader- Friday, March 14, 2008 Applelinks iPhone News Reader- Friday, March 14, 2008 First Updates of the Year: DEVONthink Pro 1. 5.

# July 13, 2008 8:20 AM

rip program said:

Visually see disk space usage in Windows Explorer Lijit Search Recent Comments David Mendonca on Nokia\'s \"Care\" Centres PBX Phone Systems on A Directory Of Programs Designed For USB Drives go on A Directory Of Programs Designed For USB Drives Jeremy

# July 13, 2008 9:11 AM
New Comments to this post are disabled