加载中
加载中
表情图片
评为精选
鼓励
加载中...
分享
加载中...
文件下载
加载中...
修改排序
加载中...
asp .net core 面向搜索引擎开发 新手入门 淌坑一览
张静茹2019/09/28软件综合 IP:山东

asp .net core 修改 cshtml 保存后 需要重新编译才能看到效果 浪费时间


解决方法:

nuget安装:

 Install-Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation


  // This method gets called by the runtime. Use this method to add services to the container.

        public void ConfigureServices(IServiceCollection services)

        {

            services.AddControllersWithViews()

                .AddRazorRuntimeCompilation();//保存cshtml 后立即生效

        }



来自:计算机科学 / 软件综合
3
新版本公告
~~空空如也
张静茹 作者
5年5个月前 修改于 5年5个月前 IP:山东
864388

pattern: "{controller=Home}/{action=Index}/{id?}");

此路由的含义是:

当网址为 https://localhost:44327/Home/Privacy 时

将寻找工程中继承了Controller并且类名为HomeController的类

访问他的Privacy方法 获得返回页面

public class HomeController : Controller

{

        public IActionResult Privacy()

        {

            return View();

        }

}

将访问工程中Views/Home/Privacy.cshtml


当网址为 https://localhost:44327 时

等效于访问https://localhost:44327/Home/Index

引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
张静茹作者
5年5个月前 修改于 5年5个月前 IP:山东
864390

form表单submit按钮提交页面不跳转

 

方案一      

1569849590497.gif

Other
 <html>       <body>              <form action="" method="post" target="nm_iframe">           <input type="text" id="id_input_text" name="nm_input_text" >           <input type="submit" id="id_submit" name="nm_submit" value="提交" >                                   </input type="submit" id="id_submit" name="nm_submit" value="提交" ></input type="text" id="id_input_text" name="nm_input_text" ></form action="" method="post" target="nm_iframe"></body>       </html>

1569849590499.gif

方案二

1569849591408.gif

Other
 <html>       <body>              <form action=" api user register" method="post"  id="registSubmit"  >           <input type="text" id="id_input_text" name="nm_input_text" >           <input type="submit" id="id_submit" name="nm_submit" value="提交" >                   </input type="submit" id="id_submit" name="nm_submit" value="提交" ></input type="text" id="id_input_text" name="nm_input_text" ></form action="></body>       </html></pre><p><span class="cnblogs_code_copy" style> $('#registSubmit').on('submit',      event.preventDefault() //阻止form表单默认提交function registPost () {         $.ajax({        type"post",        url: "/api/user/register",        data: $('#registSubmit').serialize(),    }).success(function(message) {      console.log(message)    }).fail(function(err){      console.log(err)    })    /*      或者用jquery.form.min.js提交      $('#registSubmit').ajaxSubmit(function(message){         console.log(message);      })     */}
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论

想参与大家的讨论?现在就 登录 或者 注册

所属专业
上级专业
同级专业
张静茹
进士 学者 机友 笔友
文章
139
回复
1869
学术分
1
2010/12/30注册,17天22时前活动
暂无简介
主体类型:个人
所属领域:无
认证方式:手机号
IP归属地:未同步
插入公式
评论控制
加载中...
文号:{{pid}}
投诉或举报
加载中...
{{tip}}
请选择违规类型:
{{reason.type}}

空空如也

笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的