使用Mvc.Controller按动作打印消息? VB.NET

时间:2012-11-02 18:40:10

标签: .net vb.net visual-studio

控制器


Public Class HelloWorldController
    Inherits System.Web.Mvc.Controller

    '
    ' GET: /HelloWorldController

    Function PrintMessage() As ActionResult


    End Function

End Class

网址请求

<小时/> http:// localhost:1430 / HelloWorld / PrintMessage

问题

<小时/> 如何使用上面使用的“Mvc.Controller”,方法和相应的URL请求在localhost上的Web浏览器中打印消息?

只需按一个链接或按钮即可调用方法(动作)intended

1 个答案:

答案 0 :(得分:0)

您可以使用Content方法返回字符串:

return Content("Hello World")

如果您想要格式化,请创建一个视图并将该字符串作为模型返回。