2

Im making some of my ajax visible for google. To do that, I have to provide html snapshots of my content based on a querystring (escaped fragment). The problems is, some of my html are returned by webservices calls.

I have a class, called Site.ajax._search, with webmethods inside, like:

[WebMethod(EnableSession = true)]
public string ReadSearch(string nm_what, string nm_where, int pageindex)
{
}

1 Answer 1

1

Yes, it's fine, I would also make it static:

[WebMethod(EnableSession = true)]
public static string ReadSearch(string nm_what, string nm_where, int pageindex)
{
}

//from another page
protected void Page_Load(object sender, EventArgs e)
{ 
    //example
    string s = Search.ReadSearch("this","here",2); //add namespace and references needed
}

Why do ASP.NET AJAX page methods have to be static?

Sign up to request clarification or add additional context in comments.

1 Comment

Is there any problem concerning make the method static?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.