Make Asynchronous Call In Static Class Function?
May 17, 2010is it possible to make an asynchronous call to a static class function?
View 3 Repliesis it possible to make an asynchronous call to a static class function?
View 3 Replieshow to jquery call a other call function other class is not static
[WebMethod]
public static bool Verify(string username, string password)
//Do your logic with username, password here
//I am just checking with admin/admin credentials
Console.WriteLine("Ritu");
[code]...
I have a C# asp.net file upload form with a submit button. After the form is submitted the file is uploaded and post-processing is started. The point is that the post-processing can take up to several minutes.I would like to create some kind of asynchronous call of the post-processing function with showing information to the user
View 4 RepliesI have to call a function to run a report through a web service, then call another function to get the data but only after the 1st function has finished processing. How do I make c# wait till the first function has finished processing to run the second function?
my code looks something like:
NetworkCredential Cred = new NetworkCredential("uid", "pw");
ReportWebService reportService = new ReportWebService();
reportService.Credentials = Cred;
string s = reportService.runReportAsync("0ede9884e6394daf73fa418e9bffd4fc");
string report = reportService.getReportData(s);
This code will break because s is not set since the function (runreportasynch) has not finished running to produce s.
I have a try-catch inside a method that is called asynchronously. When an error occurs, inside the catch I have a Response.Redirect because I need to redirect to the login page.
This is my issue.
But my problem doesn't involve things that expire, so the idea of a timer isn't the best way to resolve it.
I need to make a call to a function object from a click event:
[Code]....
I wrote this code in class.cs. But I want call it’s from default.aspx.cs
public ArrayList GetInfos(string NAM)
{
ArrayList list = null;
if (ViewState["ArrayData"] == null)
{
list = new ArrayList();
string str = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
[Code]......
I have an asmx web service, and every time I try to call a static method in another project (which is a class library), I get an internal server error 500.
View 3 RepliesI have a private static field in my Controller class in an MVC web application.
I have a static method in that controller that assigns some value to that static field, I want to apply lock on that static field until some other instance method in the controller uses the value stored in the static field and then releases it.
DETAILS:
I have a controller named BaseController having a static ClientId field as follows and two methods as follows:-
public static string ClientId = "";
static void OnClientConnected(string clientId, ref Dictionary<string, object> list)
{
list.Add("a", "b");
// I want the ClientId to be locked here, so that it can not be accessed by other requests coming to the server and wait for ClientId to be released:-
BaseController.clientId = clientId;
}
public ActionResult Handler()
{
if (something)
{
// use the static ClientId here
}
// Release the ClientId here, so it can now be used by other web requests coming to the server.
return View();
}
I have a question about C Sharp ASP.NET:Is there a difference (in code speed, resources) between:public static variable declared in public static class MyGlobals in a 'Code File' template;and the variable declared in a normal 'Class File' template;I use this variable in 2 different Class Files and also in _Default Page codebehind cs file.In fact in my case I need about 20 global variables of type List<string>.
View 9 RepliesHow to make a call to my WCF service asynchronous?
Here is how I am doing it
Dim wcfService = New EmailBlastService.EmailBlastServiceClient
wcfService.WCFSubCallAsync()
But when I actually do the call it seems to tie up the server for about a minute (even though I know the async process takes longer than that and is still processing the request). Even if I try to hit the page in a different browser it still takes a minute to load.
Basically I just want to make the WCF call and forget about it, I don't want users to be waiting while I am doing some heavy processing and calling an external
I'm currently working on a web site which involves a data upload process. The file is currently uploaded to the server method is called (in app_code) where ultimately a DTS package is called (via a web method) to load the data into a database and perform some validation on it.The client has specified that they don't want to have to wait for the DTS package to execute (execution time is less than 5 minutes) so it appears that I need to call the method asynchronously. The user will probably logout or close the browser window while this task is running so I believe I'm unable to run this on an asp.net thread.
View 1 RepliesSince i am fresher to .net, i m unable to handle asp.net. I have call asynchronous ajax call using XMLHTTPRequest and also use QueryString to filter Employee details.
I have following files:
1. Default.aspx code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Task2._Default" %>
<%@ Register TagPrefix="uc1" TagName="SearchResult" Src="SearchResult.ascx" %>
[code]....
3. Ajax.aspx is empty in design
what should be the code in Default.aspx.cs when u take some text in textbox to search, OnClick of "ok" button there should'nt be any postback.
I'm working on an existing web application (web site project and some class library projects). In the web site project, the guys created many web services, that are called from the aspx pages (sometimes on client side).
I need to create a new web service, so I was suggested to put it "near" the existing web services. I'm gonna need to make an asynchronous call to my new web services.
So I created the service this way, but when I try calling a method asynchronisly, I have only the method in intellisense, I don't have the method for the asynchronous call, neither the Complete event. Why is that ?
On the other hand, I created a new project, with a web service application and a web site where I added the reference to the web service, and this way I have the asynchronous method and the complete event in intellisense.
I've the following doubt. I've a page "MyPage" and i've declared few dictionary objects in the page classMy doubt isIf i declare the dictionary as a private non-static object i'm not able to use it across the functions in that page class (the object is getting nulled)able to across the object across the functions. But will that object be same across all the users who have opened the page right now (guessing that each user will have an instance of the page in turn has an instance for the page class and static variables of a class are invariable across all the instances of the class
View 4 RepliesI have an process that take about 15minutes to execute. And i have toput this process in a service, and managed his statWell, i placed this process in a service and in some specific pointi have one variable telling me how much % the process have done.So my service reference im my consumer project its typed to let asynchronous calls.When i start my process with a
[Code]...
I've created a small class library to asynchronously call a WebService(Fire and Forget. I don't need the result).In a Windows Form application, the XXXAsync() method works fine. But, in a Web Application, the process is locked until the XXXCompleted event is fire.My problem is: I tried to create a Delegate and use the Begin/EndInvoke to call the XXXAsync() method. It worked fine, but, the w3wp process seems to be consuming a huge amount of memory. I'm calling the EndInvoke method properly. Invoking the GC.Collect did not free any memory
View 1 Repliesam calling web service method asynchronously using callback method which is long running process.
In mid time in client want to cancel this asynchronous method call then can it be done....??? and if yes then how can it be done..?
i'm dealing with an ASP.NET 4.0 Web Forms Application in which the DAL is built with a combination of LINQ-SQL and classic ADO.NET (for auditing transactions, and bulk updates).
I have an admin page on the site which performs an update on a bunch of records (could be thousands), and not to mention there is T-SQL triggers in place on those records. Needless to say, its a killer of an update.
So of course, the page is timing out. The update transaction is performing with the following code:
db.ExecuteCommand("UPDATE [tblFoo] SET [IsFoo] = 0 WHERE [Bar] = {0}", bar.Id);
So it's a classic ADO.NET bulk update.
What i've tried to do is make the call to this method asynchronous, by firing off a thread on the button click on the form:
[code]...
The method OnMyAsyncMethod simply executes the above ADO.NET call.
This solved the UI problem, being the page now posts back and refreshes immediately. But then around 30 seconds lateri see that wonderful little flashing light on my Visual Studio toolbar - "an unhandled exception has occured, would you like to attach to process, etc".
So of course, now the actual call in the DAL is timing out.
Am i doing this wrong - is there a way i can perform the update transaction (db.ExecuteCommand) totally asynchrously?
Hopefully you see what im trying to do - i just need to fire off a killer of a T-SQL transaction. The only thing i need back from the call is the number of rows updated.
An external server sends incoming SMS messages converted to HTTP requests into my sometimes very time-consuming .aspx page. If no response is returned to the external server in 20 seconds, this is considered as an timeout and the same message is sent to my aspx page again (and maybe again....The optimal solution for me would be that the aspx page reads the incoming message (as an HTTP request to the aspx page), starts the processing of the message in another thread, and immediately renders response back to the external server. The external server has no interest in other stuff than the HTTP status (normally 200). When the processing of the message is completed this results in an entry into the log file of the application.
View 2 RepliesI have a table growth 100000row per day, I'm facing many problems to export data from this table using ASP.net page.
I don't know how to apply this scenario:
Senerio 1:
1- run Asynchronous function to export data from SQL for specified period to CSV file (without locking the table)
2- Refresh page every 5 sec in order to track the status of extracting data
3- compress the file
4- Stop refreshing and showing the download link in order to download the compressed file
or
Senerio 2:
1- run Asynchronous function to export data from SQL for specified period to CSV file (without locking the table)
3- compress the file
4- send the compressed file by Email
I am using PageMethods in my pages, and we have some requirement in which some maintenance process happened in certain time span, so in that time we set on DB flag consider as True False, I have written my code in Global.asax where in application_AcquireRequestState(...,...) Method I am checking the flag and depanding upon the flag I am redirecting my Page to one Maintenance dummy page, so application_AcquireRequestState() method working properly when page get postback or I am using thru any server control, but when I am using Asynchronous call using PageMethods in application_AcquireRequestState I am getting exception, Can anyone solve my problem I am using VB.NET.
[Code]....
I am using a third party service for location time(zonal).If I pass latitude and longitude of the location with service URL it returns the time of that location in XML format.But the problem is some of the time this service gets too much slow so because of that my home page gets stuck because its a synchronous call of that service.here my code-
string TimeZoneUrl = "http://ws.geonames.org/timezone?";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(TimeZoneUrl + "lat=" + latitude + "&lng=" + longitude);
XmlElement root = xmlDoc.DocumentElement;
XmlNodeList nodes = root.SelectNodes("//*");
How can I make this a asynchronous call?
<asp:LinkButton CssClass="button" ID="btnApply" runat="server" OnClick="btnApply_Click()" OnClientClick="Apply1('btnApply')" >
hi ihave this functin in .vb file
Protected Sub btnApply_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnApply.Click
end sub
and javascript function also in aspx
function ApplySummerization(id)
{
alert("hai");
}
I am building a page with databound list control. For each row I want to display piece of info retrieved from web service call. This could be time demanding so I want to render page first and retrieved additional info asynchronously and in parallel later on. Anyone has some tips how to make it? Just to have a more detailed picture it is a product list in e-shop which I want to render so customers can use it (go to product detail/add goods to shopping cart...) but meantime there will be a placeholder displaying info that informations are retrieving which after completion of call will be replaced by result data.
View 2 Replies