> For the complete documentation index, see [llms.txt](https://docs.wisej.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/api/wisej.core/general/wisej.core.webmethodattribute.md).

# WebMethodAttribute

Namespace: **Wisej.Core**

Assembly: **Wisej.Framework** (4.0.0.0)

Indicates that the method can be called from the browser using JavaScript.

{% tabs %}
{% tab title="C#" %}

```csharp
public class WebMethodAttribute : Attribute
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class WebMethodAttribute
    Inherits Attribute
```

{% endtab %}
{% endtabs %}

You can add this attribute to static methods in your Wisej application Program class and to instance methods in top level containers: Page, Form, and Desktop.\
If you want to register web methods on child controls, you can, but Wisej only searches top level containers automatically. To register web methods on a child control, extend the control class, override [OnWebRender](/api/wisej.web/general/control.md#onwebrender) and call [RegisterWebMethods](/api/wisej.web/general/control.md#registerwebmethods).

```csharp

public class MyButton : Button
{
  protected override void OnWebRender(dynamic config)
  {
    base.OnWebRender((object)config);
    RegisterWebMethods(config);
  }
}

```

Default parameters are not supported in Web Methods. This is supported:

```csharp

[WebMethod]
public void myWebMethod(string s)

```

But this is not supported:

```csharp

[WebMethod]
public void myWebMethod(string s = "default value")

```

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) WebMethodAttribute()

Initializes the [WebMethodAttribute](/api/wisej.core/general/wisej.core.webmethodattribute.md) attribute.

### ![](/files/hsR4ok3152WyAf8J2C1u) WebMethodAttribute(inheritable)

Initializes the [WebMethodAttribute](/api/wisej.core/general/wisej.core.webmethodattribute.md) attribute.

| Name            | Type                                                            | Description                                                       |
| --------------- | --------------------------------------------------------------- | ----------------------------------------------------------------- |
| **inheritable** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | Indicates whether the web method is inherited by derived classes. |

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) Inheritable

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether the web method is inherited by derived classes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/api/wisej.core/general/wisej.core.webmethodattribute.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
