Pass a simple string from controller to a view MVC3

前端 未结 6 1701
青春惊慌失措
青春惊慌失措 2021-01-31 02:19

I know this seems pretty basic, and it should be, but I cant find out where I am going wrong. (I hve read other articles with similar titles on SO, and other resources on the we

6条回答
  •  北海茫月
    2021-01-31 02:41

    If you are trying to simply return a string to a View, try this:

    public string Test()
    {
         return "test";
    }
    

    This will return a view with the word test in it. You can insert some html in the string.

    You can also try this:

    public ActionResult Index()
    {
        return Content("test");
    }
    

提交回复
热议问题