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


Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Asad Ali
Post New Web Links

Asynchronous ASP.NET Page Processing in Layered Architecture

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :ASP.Net
 

I am working on an application which involves payment gateways. Payment gateway takes some 4-5 seconds to respond. To tune the application I thought of using PageAsyncTask whenever Payments are processed.

My application uses multiple layers, for e.g before hitting to payment gateway, all sorts of calculations(taxes and all) are calculated in bussiness layer and then the payment gateway processing is done in the data access layer. Method which performs the Payments  also returns some custom message to top layers based on the response value. This is done by setting a property in the DAL class.

Now issue is how to register BeginEventHandler and EndEventHandler. I tried creating a sample application for this. But when I debugged my EndEventHandler was not getting called at all.

Sample Scenario..

On a button click event I am trying to call a DAL method which will create a HttpWebRequest and will return the response to me in a string variable

My Page Class has Events below:

protected void btnSubmit_Click(object sender, EventArgs e)
        {
            
            PageAsyncTask task = new PageAsyncTask(new BeginEventHandler(BeginAsyncOperation), new EndEventHandler(EndAsyncOperation),new EndEventHandler(TimeoutAsyncOperation), "" );
            RegisterAsyncTask(task);



View Complete Post


More Related Resource Links

Asynchronous ASP.NET Page Processing(PageAsyncTask) in Layered Architecture

  

I am working on an application which involves payment gateways. Payment gateway takes some 4-5 seconds to respond. To tune the application I thought of using PageAsyncTask whenever Payments are processed.

My application uses multiple layers, for e.g before hitting to payment gateway, all sorts of calculations(taxes and all) are calculated in bussiness layer and then the payment gateway processing is done in the data access layer. Method which performs the Payments  also returns some custom message to top layers based on the response value. This is done by setting a property in the DAL class.

Now issue is how to register BeginEventHandler and EndEventHandler. I tried creating a sample application for this. But when I debugged my EndEventHandler was not getting called at all.

Sample Scenario..

On a button click event I am trying to call a DAL method which will create a HttpWebRequest and will return the response to me in a string variable

My Page Class has Events below:

protected void btnSubmit_Click(object sender, EventArgs e)
        {
            
            PageAsyncTask task = new PageAsyncTask(new BeginEventHandler(BeginAsyncOperation), new EndEventHandler(EndAsyncOperation),new EndEventHandler(TimeoutAsyncOperation), "" );
            RegisterAsyncTask(t

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.

.NET Matters: Asynchronous Stream Processing

  

This month Stephen Toub discusses asynchronous stream processing.

Stephen Toub

MSDN Magazine March 2008


Do ASP.NET Crystal Reports support asynchronous processing

  
CR reports take too much of processing time for our web app. I have modified the process to generate reports in the background using ASP.NET asynchronus pages concept. But now, the reports do NOT render at all. This makes me wonder whether they support background processing at all.CR reports take too much of processing time for our web app. I have modified the process to generate reports in the background using ASP.NET asynchronus pages concept.But now, the reports do NOT render at all. This makes me wonder whether they support background processing at all.

master page data processing

  
hi...I have added code below and the problem isMy database insertion is working good with normal asp.net page but when it is a content page of master page, stucking me to insert data in database. One of the expert is suggesting me to take the advantage of SQL Server Profiler to accomplish it, but I don't know anything about sql profiler. I only know about stored procedures but don't know what is sql server profiler?*************************************My Code Behind*************************************public string GetConnectionString() { return System.Configuration.ConfigurationManager.ConnectionStrings["myDbConnectionString1"].ConnectionString; } private void execution(string name, string username, string password, string emailid) { SqlConnection conn = new SqlConnection(GetConnectionString()); string sql = "INSERT INTO myTb (name, username, password, emailid) VALUES " + " (@name, @username, @password, @emailid)"; try { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); SqlParameter[] pram = new SqlParameter[4]; pram[0] = new SqlParameter("@name", SqlDbType.VarChar, 50); pram[1] = new SqlParameter("@username", SqlDbType.VarChar, 50); pram[2] = new SqlParameter("@password&quo

Exception during asynchronous processing.

  

I have a pattern like:

          FunctionDelegatge function = new FunctionDelegatge (MyFunction);

          function.BeginInvoke(arg1, arg2, arg3, new AsyncCallback((far) =>

          {

           if (far.IsCompleted)

           {

            lock (resultLock) result.Add(function.EndInvoke(far));

            Interlocked.Decrement(ref orderCount);

           }

          }), null);



Right now every once and a while I get an exception that simply states 'A severe error occured'. In order to track down this error I was wondering if I could get some help in understanding what happens to an exception during asyncronous processing. Specifically what happens if an exception is raised in 'MyFunction' above? How can I safely catch this exception and still have the exception information available for the asynchronous delegate? Ideally I would like to have status something like the BackgroundWorker class where in the process complete method one can test a property to see if an error occurred. Also what if arg1 etc. was a SqlConnection that if the connection is terminated (this is within a WCF web service)

Articles/Links on Asp.Net pipeline and internal request processing architecture

  

I am looking details on the internal working of asp.net architecture. The topics need to include the following:

  1. Asp.Net Thread/Application Pools
  2. HttpRuntime
  3. HttpApplication - When and how it is set up
  4. How HttpContext is set up
  5. How objects can passed along the pipeline using HttpContext.Current.Items
  6. Why does modification of static variables requires locks in ASP.NET (advanced)
  7. IIS 7 Integration Mode

I'm looking for a very detailed description of Asp.Net internals and how request processing happens under the hood.

How to prevent master page postback when update panel asynchronous postback happened

  

Hello everybody.

When an asynchronous postback happened inside update panel, another postback happens also for MasterPage not only update panel embedded page .

I want to prevent this MasterPage postback .

is this possible ?



think like i have a MasterPage

and another page which is test.aspx which is content page of MasterPage

i have update panel at test.aspx

when asynchronous postback happens at this test.aspx update panel it also loads MasterPage Page_Load

i want to prevent this (it should not also load MasterPage Page_Load)



Thank you


How to keep whole page scroll position after asynchronous postback

  

Hello everybody. i am using asp.net 4.0 iis 7.5 microsoft visual studio 2010

what i want is keep whole page (browser) scroll position (not a div or panel) when asynchronous postback happened (update panel)

how can i do this

actually i had a function which can keep div scroll bar position after postback like this

 

   <script type="text/javascript">
            var xPos, yPos;
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            prm.add_beginRequest(BeginRequestHandler);
            prm.add_endRequest(EndRequestHandler);
            function BeginRequestHandler(sender, args) {
                xPos = document.getElementById('Main').scrollLeft;
                yPos = document.getElementById('Main').scrollTop;
            }
            function EndRequestHandler(sender, args) {
                document.getElementById('Main').scrollLeft = xPos;
                document.getElementById('Main').scrollTop = yPos;
            }
        </script>
        


 

but i could not find browser scroll bar id to get its values to get with document.getElementById

thanks for answers


Asynchronous update of page immediately after load to improve response time

  
The article Asynchronous update of page immediately after load to improve response time was added by kaushalendrarai on Monday, March 14, 2011.

Response time is one of major factor in deciding the performance of web application. Many time we come across pages where content of page can be updated asynchronously immediatly after the page rendering in responce to page request. We can achive this

Architecture Tools in VSTS 2010

  
Designing new functionality on existing applications can be daunting. There are always differences between the original design and the current implementation.

The new Architecture tools within Visual Studio Team System 2010 help you understand the application you have, design new functionality you need, and validate that your design and your implementation do not deviate.

Changing the graphics on the home page of a SharePoint site

  
When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

SharePoint Tutorial - SharePoint Logical Architecture

  
The SharePoint logical architecure consists of nested and isolated levels. These levels provide benefits for security, navigation, search, branding and ect. depending on the level

SharePoint Farm
The base level for any SharePoint implementation is the SharePoint farm. Physically a farm can consist of one server or many servers. An organization may implement one or more farms. This usually depends on security and performance needs.

SharePoint Tutorial -SharePoint Physical Architecture

  
The SharePoint physical architecture consists of services running on one or more servers.

Services
There are three types of services that together run the SharePoint farm: web, application and database services. Web services through Internet Information Server is what processes the ASP.Net and sends back the html to a user's browser. Application services is where the "brains" of SharePoint are located. All of the SharePoint specific logic and services are processed there. Database services are run by SQL Server and it's where all the data/content for SharePoint is stored.

jQuery $(document).ready() and ASP.NET Ajax asynchronous postback

  
Many call it the ASP.NET jQuery postback problem, but using the technique below should make it no problem anymore. $(document).ready() isn't called after an asynchronous postback. What this means? You lose the functionality that should be executed within $(document).ready() after an UpdatePanel rendered its contents after an asynchronous postback.

Using jQuery to directly call ASP.NET AJAX page methods

  
Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

jQuery live() and ASP.NET Ajax asynchronous postback

  
The issue is that normally $(document).ready() is called when the DOM is ready to be manipulated. But this doens't happen after an ASP.NET Ajax asynch postback occurs.

This means that the initial jQuery bindings won't be automatically available after the asynchronous postback is over. I underline "automatically" here because my last post describes more possibilities, how this issue can be worked around.
Categories: 
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