学习NetCore应用框架——数据交换

此文档解决以下问题:

1.返回字符串类型数据

2.地址栏传值返回数据(绝对路径)

附:ASP.NET Core 官方文档 地址:https://docs.microsoft.com/zh-cn/aspnet/core/?view=aspnetcore-2.2


1.返回字符串类型数据

 1)AccountController.cs

        public string GetString()
        {
            //返回字符串类型数据
            //可在浏览器中通过 localhost:端口/[ControllerName]/[MethodName]执行
            //这里是   localhost:端口/Account/GetString
            return "字符串测试数据";
        }

2)运行浏览

2.地址栏传值返回数据(绝对路径)

  1)AccountController.cs

        public string GetString2(int code, string msg)
        {
            //返回字符串类型数据
            //可在浏览器中通过 localhost:端口/[ControllerName]/[MethodName]执行
            //这里是   localhost:端口/Account/GetString2?code=0&msg=测试成功
            return "字符串测试数据:name=" + code + " *** msg:" + msg;
        }

 2)运行浏览

  正文结束~~~

猜你喜欢

转载自www.cnblogs.com/yankyblogs/p/11327559.html