Can ASP.Net form have method=get or post attribute?

asp.net, forms, webforms

Solution

Thanks for your answers.

I would like to share some points which I found.

By default the `form` with `runat="server"`, will have `method="post"`.

But when we request a page for the first time, (i.e) request is not a postback, the `method="get"`.

And it becomes `method="post"`,while postback.

I checked this by placing a piece of code in code behind:

In Page_Load():

if(Request.RequestType=="GET")
{
Response.Write("Request is a GET type");
}
else if(Request.RequestType=="POST")
{
Response.Write("Request is a POST type");
}

By default, the output

For the first request of that page: `Request is a GET type`

In postback: `Request is a POST type`

If i give the following code in the `WebForm1.aspx`

<form id="form1" runat="server" method="get">

For this, the output will be:

For the first request of that page: `Request is a GET type`

In postback: `Request is a GET type`

This is what I found.

Thank you very much for your responses.

Problem

I am new to asp.net. My question is, can a ASP.net form with runat="server", have a method attribute in it? For example: ``` <form id="form1" runat="server" method="get"> ....... </form> ``` Is this possible?

Original source