.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

ScriptManager does not execute all script blocks registered when making multiple asynchronous HTTP r

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

I have found a bug in the ScriptManager.  I am executing Javascript in multiple Update Panels.  I have EnablePartialRendering mode set to true and and the UpdatePanels have update mode set to conditional.

Each UpdatePanel is in a ascx control, and these controls are added to he page programtically using Page.LoadControl().

When the client performs some UI actions in the browser, I am calling __doPostBack().  Each .ascx control will register client script block to be executed in it's UpdatePanel using ScriptManager.RegisterClientScriptBlock(), and each .ascx control uses a unique key when registering the script block.

Everything works as advertised when there is only one _doPostBack() being called at a time, (one HTTP Request).  The problem only occurs when __doPostBack is called before the previous __doPostBack causes the JavaScript registered in the ScriptManager is executed.  When there are multiple, simultaneous, asyncrhonous HTTP Requests to the same page with the same session, only the most recent JavaScript is executed that was registered with ScriptManager.RegisterClientScriptBlock().

I have tested this with both .NET 2.0 and .NET 3.5.  I can produce a VS 2008 solution that demonstrates this problem.  The only way for me to resolve this issue is to prevent multiple calls to __doPostBac

View Complete Post

More Related Resource Links

ScriptManager CompositeScript Error: A script reference cannot be included multiple times in composi

I am getting the following error using the CompositeScript feature of the ScriptManager.  I have ScriptManagerProxy in several different usercontrols that use CompositeScript to add whatever JS files they need.  Sometimes there are duplicates which would get removed by the script manager, but that is not happening with the Composite Scripts.  Looking at the stack trace, it calls RemoveDuplicates but for some reason it doesn't do so.  Is this a bug?  Is there a workaround or a hotfix? Thanks! A script reference cannot be included multiple times in composite script references. Stack Trace: [InvalidOperationException: A script reference cannot be included multiple times in composite script references.]   System.Web.UI.ScriptManager.RemoveDuplicates(List`1 scripts) +698   System.Web.UI.ScriptManager.RegisterScripts() +328   System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +113   System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8695102   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029

.NET Delegates: Making Asynchronous Method Calls in the .NET Environment


One of the many great features of the .NET Framework is that it has asynchronous infrastructure built in. In .NET you can call any method asynchronously by defining a delegate for the method and calling the delegate's asynchronous methods. This is beneficial to your application because when a synchronous call is made, the calling thread is blocked until the method completes whereas an asynchronous call is made on a different thread, and this allows the original thread to continue its work while the asynchronous call is in progress.This article explains delegates in .NET and how to use them to perform asynchronous calls, eliminating age-old threading problems.

Richard Grimes

MSDN Magazine August 2001

How to bind a WCF Http client to a specific outbound IPAddress before making the request

I want my request to go out through a specific IP Addresses. Is there a way to do that in WCF. The explanation of why I need this is a little long winded so i'd rather not get into that. Here is sample code string ipAddress = ""; IService service; ChannelFactory<IOmlService> factory = new ChannelFactory<IService>(new BasicHttpBinding(), new EndpointAddress("http://" + IPAddress + ":6996/IService")); service = factory.CreateChannel(); service.Test(); Here is an example scenario to explain exactly what i'm looking for. Let's say I have two IPs on my machine ( and Both of them can hit If i run this code now, it will hit the IP (.32) from any of my IPs (.30 or .31). How can i force it to go through a specific IP of mine (say .30). Is there any way to do that using WCF? Thanks

Receive/Delete Multiple FTP Files based on condition using SCRIPT(VB) TASK

I am trying to receive and delete multiple FTP files from a remote FTP server using Script task Below is the code   Dim FTPConnMgr As ConnectionManager FTPConnMgr = Dts.Connections("FTP Connection Manager") Dim FTPClientConn As FtpClientConnection = New FtpClientConnection(FTPConnMgr.AcquireConnection(Nothing)) Dim FileTimeStampNew As String = "20100913021807" Dim remoteFileNames(0) As String remoteFileNames(0) = Dts.Variables("FtpRemoteDirectory").Value & "*" & FileTimeStampNew & ".*" 'Below hardcoded FileName works good. But the problem is there are lots of file in the FTP folder that I dont want to receive 'remoteFileNames(0) = Dts.Variables("FtpRemoteDirectory").Value & "Company_alpha_Full_20100913021807.xml" Dim localPath As String = Dts.Variables("FtpLocalDirectory").Value FTPClientConn.Connect() FTPClientConn.ReceiveFiles(remoteFileNames, localPath, False, False) FTPClientConn.Close() Dts.TaskResult = ScriptResults.Success End Sub End Class If i specifically mention the RemotefileNames this works fine but, when I say *.* it executes succefully but doesn't receives the file. Please advice how to receive multiple file based on a variable BR, AWM

Making asynchronous calls to web services during ASP.NET page processing

Some ASP.NET web applications use web services to get some data that they display to users. Some pages may lay hardly on web services and these pages need some optimization to work better. In this posting I will show you how to use web services behind your ASP.NET page asynchronously and perform a lot of queries to web services. Sample code included! Eneta.Examples.WebAppThreading.zip VS2008 solution | 60KB Asynchronous page processing As an introduction let's see how ASP.NET supports asynchronous calls behind pages. Although we can use our own threading mechanism and avoid what is offered by ASP.NET it is more safe and time saving to use ASP.NET own infrastructure. The image on right that I stole from MSDN article Asynchronous Pages in ASP.NET 2.0 shows you how synchronous and asynchronous pages are processed by ASP.NET. I recommend to read this MSDN article because you can find also other methods for asynchronous calls. I will introduce you how to use PageAsyncTask based calls. If you look at diagram on right you can see that asynchronous processing of registered tasks happens between PreRender and PreRenderComplete events in separate threads. If we have data bound controls on our page we have to move data binding to PreRenderComplete event because this is the closest phase of page processing where asynchronous calls are finished.

Script Component - Change One Row Input to Multiple Row Output

Hi All I am new to SSIS, and looking for help. I do not know if it is possible, but I like to try using the "Script Component" to change a input like this:   1234 1235 1236 ...   to and output like this:   1234, Value1 1235, Value2 1235, Value3 1235, Value4 1236, Value5 ...   Depending of the input value, 1 or more Rows are pushed out the Output, Like the value 1234 -> result in 1 Row in the output, where the value 1235 -> result in 3 rows in the output. Is this possible to do in a Script Component?? If it is how do you program such behavior? Do some good sources to learn SSIS exist out there?? I think it is not easy to find information. Peter Schwennesen

Multiple-step OLE DB operation generated errors in Pre-Execute

Hello, I am getting below error; what could be the reason? The input is valid adn works good if I give to a multicast for test. But I get below error when I use OLEDB Destination ("table or view fast load") as my target. Note: Columns mappings are done auto by SSIS and All looks good as my source and destination are having same names as well. [Stage - Issue [33923]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E21. An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80040E21  Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". [Stage - Issue [33923]] Error: Cannot create an OLE DB accessor. Verify that the column metadata is valid. [DTS.Pipeline] Error: component "Stage - Issue" (33923) failed the pre-execute phase and returned error code 0xC0202025. Thanks, Prabhat

Send multiple parameters SSIS execute process task



We are using Execute Process Task in SSIS package to execute a batch file to house keep the generated flat files which are older than a week from the archive folder.

The same batch file is used to delete the some temp files generated in the process.

As the Archive folder and temp folder paths are configurable, we are trying to pass the folder paths as parameters to batch file.

I used Expressions tab of Execute process Task Editor to map the variable to Arguments property. This is working fine. but I need to pass one more variable as an Argument.

Can some one help me how to achieve this. Thanks in advance.


Sreekanth ABS



Sending multiple HTTP requests asynchronously using .NET



  Is it possible to send multiple HTTP requests asynchronously to an ASP.NET web site or any other web server using .NET ? And, then. collect responses from those requests as they come using .NET asynchronous paradigm ? Is it possible ? Or would there still be limit of max 2 HTTP connections from .NET using HTTP ?

Thanks in advance and regards



Client Script Replace Problem with .NET 4.0 ScriptManager



I want to replace the WebUIValidation.js client script (located in System.Web assembly) with my own custom script using the new script replacement features in .NET 4.0.

The replacement works fine in a simple sample form I created, but in my much more complicated wizard form it fails.  On partial post-back the ScriptManager writes the System.Web version to the browser and I end up with both Microsoft's version and my version of the script in the browser. Since the System.Web version loads last, it replaces my custom script.

I am using the ToolkitScriptManager intead of the ScriptManager everywhere. The form that needs the replacement has dynamically created controls (including the validation controls) and has several control extenders based on the AjaxControlToolkit.

Does anyone have any ideas on what could be going wrong, or have any ideas on a workaround for this?

Any help will be appreaciated,


ScriptManager and script placement in the Head versus Form tag



I am using a ScriptManager to place needed scripts on thepage at run time; however, it sometimes places them within the Form tag and sometimes within the Head tag.  Does anyone know what conditions the ScriptManager uses to deteremine where to drop the scripts?  Or, is there a way to force it to always use one or the other?

Thank you.

How to execute an SQL script from within Visual Studio Web Developer Express 2010??


How to execute an SQL script from within Visual Studio Web Developer Express 2010? Can someone please help with this? The MSDN help reference (http://msdn.microsoft.com/en-us/library/yea4bc1b.aspx) appears to be inaccurate as the "run" and "run on" options do not show in when the script is right clicked for the context menu.

FYI, I am using the default SQL server (express?) that comes with out of the box with VS Web developer express 2010.

Thanks in advance for your help. 

Multiple websites- same code behind but different html and css- making templates


I have atleast 10 websites that have different css,html,javasacripts and webconfig. But the same code behind files.With this design everything is hard to maintain. So I decided to work on it and I started moving all the queries in the code beghind file to stored procedures. Since every website uses the same database.

What I have decided is to make use of themes and multiple master pages? IS this the best way to go about it?

Also lets say I have two templates. There is site A and site B. both using different templates. And have pages Home About Us and Contact.


Now would I be creating three different masterpages? for each template so 6 in total? ( since none of the templates are supposed to look the same)

or Should I just create two masterpages? if so how would I manage the html of the page so it looks different? Thank you

how to execute ALTER table for multiple columns


I have an SQL table called tbl, im trying to add the columns A, B and C to it.

When i execute the command :

 addcolumns = "ALTER TABLE SqlCreatedTbl ADD A char(50) ;";


 cmd = new SqlCommand(addcolumns, conn);

conn.Open(); cmd.ExecuteNonQuery();

The column is added perfectly and i can see it in the table !

However, when i try to add multiple columns, it does NOT work, it gives me an error..

the command im writting for adding multiple columns is the following:

addcolumns = "ALTER TABLE SqlCreatedTbl ADD ( A char(50), B char(50), C char(50) );";

the debugger highlights the line : cmd.ExecuteNonQuery(); and throws the following exception: Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near '('.


multiple web service requests to an SSL secured service (HTTP CONNECT)


I'm working on an app which makes multiple SSL requests to a web service. The service has the certificate, there are no client certificates in use. If I look at the messages in Fiddler, it looks like there is an HTTP CONNECT for every request, which gets the servers public key and then makes the actual SSL request. 

Do I need to do something in the client proxy code to cache the servers certificate to avoid the HTTP CONNECT call every time?

Thanks, casey

How to execute a parameterized stored procedure using ssis dataflow script component transformation


Hi All,

Can any body send code for how to execute a parameterized stored procedure  using ssis dataflow script component transformation using .net

I know how to execute storedproc using control flow script task, but I need using ssis dataflow script component transformation.




How to set multiple value for a lookup field with powershell script?


I have a list that has a lookup column and can have multiple values.  I know how to set value to this field with powershell script. I need to know how to set multiple values to this field. 

Also, how can I create this field with powershell script?

Thanks and regards,


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend