I have static method in which I want to extract querystring
value of the request. But it gives me null
value when i am calling it from webmethod
. Below is the some code
public static int GetLatestAssetId()
{
int itemid=0;
if (HttpContext.Current.Request.QueryString["itemId"] != null)
itemid = Convert.ToInt32(HttpContext.Current.Request.QueryString["itemId"]);
return itemid;
}
[WebMethod]
public static string GetContactData()
{
GetLatestAssetId();
return "Success"
}
I am calling this webmethod from the ajax call.It works fine in page load but not in static method. How do I use this in static method. Please assist.
EndXXXX
method of an async[WebMethod]
pair? – BerniceHttpContext.Current
that is returningnull
? It strikes me as odd that this wouldn't work; but: have you tried using a regular web-method rather than a page-method? (i.e. non-static etc) – BerniceHttpContext.Current
gives me count of querystring as 0 – Milliken