ASP.Net MVC Controller Actions that return void

前端 未结 3 705
忘了有多久
忘了有多久 2020-12-03 06:26

If I have the following controller action...

public void DoSomething()
{
}

will the framework actually convert it to this?

         


        
3条回答
  •  无人及你
    2020-12-03 06:54

    It won't "convert" it, but the two would have the same effect as far as the user is concern. A request would be sent, but no response would come back to the client.

    Personally, I think you need to send some response back to the client, even if you just write a continue or success directly to the response stream. Even a JSON true, or an empty XML document is better than nothing at all.

提交回复
热议问题