WebMethod asynchronous

H

Hollow Quincy

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
 
J

Jason Keats

Hollow said:
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.
 
H

Hollow Quincy

Hollow said:
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 ?
 
J

Jason Keats

Hollow said:
Hollow said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top