关于 ASP.NET Core 中的 RazorPages
2019-06-30 15:28 音乐让我说 阅读(350) 评论(0) 编辑 收藏 举报Contact.cshtml
@page @model ContactModel @{ ViewData["Title"] = "Contact"; } <h2>@ViewData["Title"]</h2> <h3>@Model.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> </address>
Contact.cshtml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.RazorPages; namespace RazorPagesSample.Pages { public class ContactModel : PageModel { public string Message { get; set; } public void OnGet() { Message = "Your contact page."; } } }
所有 RazorPages 的示例下载:https://files.cnblogs.com/files/Music/RazorPagesSample.rar
谢谢浏览!
作者:音乐让我说(音乐让我说 - 博客园)
出处:http://music.cnblogs.com/
文章版权归本人所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步