为了账号安全,请及时绑定邮箱和手机立即绑定

如何从返回类型为“内容”的 MVC 控制器返回链接

如何从返回类型为“内容”的 MVC 控制器返回链接

C#
潇湘沐 2021-07-17 15:03:37
我想返回一种内容类型,但内容中有一个 URL。下面是我的代码。public ActionResult Safari() {    return Content("<html>Click this URL <a href ="https://www.google.com/chrome"</html>");}我希望将链接Google.com呈现为超链接而不是文本。出于某种原因,我不想返回 view.cshtml 页面。尝试:return Content("<html>Click this URL <a href ="https://www.google.com/chrome"</html>");return Content(@"<html>Click this URL <a href ="https://www.google.com/chrome"</html>");return Content("<html>Click this URL <a href =/"https://www.google.com/chrome/"</html>");其他尝试:public ActionResult Safari() {    return Content("< a href = 'google.com/chrome' > Click this URL </ a > ");}
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 174 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号