Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > WebMethod asynchronous

Reply
Thread Tools

WebMethod asynchronous

 
 
Hollow Quincy
Guest
Posts: n/a
 
      03-08-2011
Hi, I have webmethod in code behind:

[System.Web.Services.WebMethod]
public static string f(string arg) { return "a"; }

In aspx I have:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="Dad._Default" Async='true'%>
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true" />
<script type="text/javascript">
PageMethods.f('arg',CallSuccess, CallFailed);

Is it asynchronous call of this webmethod or is it synchronous ?
I can't find the answer.. I suspect, that it is synchronous because
my firefox doesn't respond for a while..

Thank you for help
 
Reply With Quote
 
 
 
 
Jason Keats
Guest
Posts: n/a
 
      03-09-2011
Hollow Quincy wrote:
> Hi, I have webmethod in code behind:
>
> [System.Web.Services.WebMethod]
> public static string f(string arg) { return "a"; }
>
> In aspx I have:
> <%@ Page Language="C#" AutoEventWireup="true"
> CodeBehind="Default.aspx.cs" Inherits="Dad._Default" Async='true'%>
> <asp:ScriptManager ID="ScriptManager1" runat="server"
> EnablePageMethods="true" />
> <script type="text/javascript">
> PageMethods.f('arg',CallSuccess, CallFailed);
>
> Is it asynchronous call of this webmethod or is it synchronous ?
> I can't find the answer.. I suspect, that it is synchronous because
> my firefox doesn't respond for a while..
>
> Thank you for help



I'm a little confused, as I would only expect to see the WebMethod
attribute on a web service - not on a method within an ASP.NET website
(which is implied by your use of the term "code behind").

Calls to (code behind) methods within an ASP.NET website are
synchronous. Calls to methods in a web service may by synchronous or
asynchronous - depending on how they're coded.
 
Reply With Quote
 
 
 
 
Hollow Quincy
Guest
Posts: n/a
 
      03-09-2011
On 9 Mar, 13:25, Jason Keats <(E-Mail Removed)> wrote:
> Hollow Quincy wrote:
> > Hi, I have webmethod in code behind:

>
> > [System.Web.Services.WebMethod]
> > public static string f(string arg) * { return "a"; }

>
> > In aspx I have:
> > <%@ Page Language="C#" AutoEventWireup="true"
> > CodeBehind="Default.aspx.cs" Inherits="Dad._Default" Async='true'%>
> > <asp:ScriptManager ID="ScriptManager1" runat="server"
> > EnablePageMethods="true" */>
> > <script type="text/javascript">
> > PageMethods.f('arg',CallSuccess, CallFailed);

>
> > Is it asynchronous call of this webmethod or is it synchronous ?
> > I can't find the answer.. *I suspect, that it is synchronous because
> > my firefox doesn't respond for a while..

>
> > Thank you for help

>
> I'm a little confused, as I would only expect to see the WebMethod
> attribute on a web service - not on a method within an ASP.NET website
> (which is implied by your use of the term "code behind").
>
> Calls to (code behind) methods within an ASP.NET website are
> synchronous. Calls to methods in a web service may by synchronous or
> asynchronous - depending on how they're coded.


So I am using synchronous calls..
<script type="text/javascript">
PageMethods.f('arg',CallSuccess, CallFailed);
So how can I do it asynchronous ?

 
Reply With Quote
 
Jason Keats
Guest
Posts: n/a
 
      03-09-2011
Hollow Quincy wrote:
> On 9 Mar, 13:25, Jason Keats<(E-Mail Removed)> wrote:
>> Hollow Quincy wrote:
>>> Hi, I have webmethod in code behind:

>>
>>> [System.Web.Services.WebMethod]
>>> public static string f(string arg) { return "a"; }

>>
>>> In aspx I have:
>>> <%@ Page Language="C#" AutoEventWireup="true"
>>> CodeBehind="Default.aspx.cs" Inherits="Dad._Default" Async='true'%>
>>> <asp:ScriptManager ID="ScriptManager1" runat="server"
>>> EnablePageMethods="true" />
>>> <script type="text/javascript">
>>> PageMethods.f('arg',CallSuccess, CallFailed);

>>
>>> Is it asynchronous call of this webmethod or is it synchronous ?
>>> I can't find the answer.. I suspect, that it is synchronous because
>>> my firefox doesn't respond for a while..

>>
>>> Thank you for help

>>
>> I'm a little confused, as I would only expect to see the WebMethod
>> attribute on a web service - not on a method within an ASP.NET website
>> (which is implied by your use of the term "code behind").
>>
>> Calls to (code behind) methods within an ASP.NET website are
>> synchronous. Calls to methods in a web service may by synchronous or
>> asynchronous - depending on how they're coded.

>
> So I am using synchronous calls..
> <script type="text/javascript">
> PageMethods.f('arg',CallSuccess, CallFailed);
> So how can I do it asynchronous ?
>


Sorry, I got it slightly wrong in my previous statement. I should have
said that calls to (code behind) methods within your ASP.NET site are
synchronous if you're using a normal postback approach - however, it
looks like you're wanting to use JavaScript.

I'm still uncertain whether you want to use JavaScript to
(asynchronously) call a method within your own site, or one within a
separate webservice. Are you using jQuery or something else?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in invoking WebMethod at client side Ram P. Dash ASP .Net 0 11-18-2005 12:06 AM
Catch WebMethod name and params in Application_BeginRequest Franck ASP .Net 1 10-04-2005 11:26 AM
Strange Exception with WebMethod Kevin Spencer ASP .Net 2 10-28-2004 01:31 PM
[WebMethod] doesn' work for properties in WebService sunnyz ASP .Net 1 10-15-2004 07:30 PM
Pulling DataSet From WebMethod -- Possible? Temp ASP .Net 1 08-11-2003 05:13 AM



Advertisments