jsp 和asp .net mvc Bug经验


JSP(6.17)

找不到数据库
    context文件是否修改
    是否导包
    util包下数据库名是否错误

找不到该数据库下的表
        检查该表是否存在于该数据库下,创表前是否 use 数据库名
        
        

out.print("<script type=\"text/javascript\">alert(\"保存成功\");window.location.href='index.jsp'</script>");
servlet页面使用window.location.href跳页面不刷新
location.href刷新页面
        
JQuery提交表单数据用$("form").serialize()容易乱码    
form表单直接提交采取input声明name,直接获取值

字符串中a标签地址无需加单引

是否删除:<a href=RainManager?opr=del&id="+this.id+"  οnclick='return del()'>删除</a>
        function del() {
            return confirm('是否删除');
        }

C#OOP(7.8)
获取dgv控件的一列值:  dgvShow.CurrentRow.Cells["SName"].Value.ToString();

dgv绑定List: this.dgvShow.DataSource = new BindingList<SE>(list);

dgv绑定dictionary: 
    BindingSource bs = new BindingSource();
                bs.DataSource = recordList.Values;
                this.dgvShow.DataSource = bs;

MVC(7.26)
//设置值:
  HttpCookie httpCookie = System.Web.HttpContext.Current.Response.Cookies.Get("USERINFO_USERNAME");
            httpCookie.Expires = DateTime.Now.AddHours(-2);

 //得到cookie值
            HttpCookie httpCookie = System.Web.HttpContext.Current.Request.Cookies.Get("USERINFO_USERNAME");
            

7.30
票证字符传值
1.web.config要设置,否则得不到值
    <system.web>
        <authentication mode="Forms">
          <forms loginUrl="~/Login/Login" timeout="1440"></forms>
        </authentication>
    </system.web>
2.//用户名设置值                 
FormsAuthentication.SetAuthCookie(admin.MName, opretation.Success);    
//得值
var name = this.User.Identity.IsAuthenticated ? this.User.Identity.Name : null;

8.4
表单验证
https://www.runoob.com/jquery/jquery-plugin-validate.html

8.5
存储过程分页(数据库分页代码,查询返回两张表,使用输出参数会写死数据库帮助类)

当使用Dapper框架时,使用输出参数方法,修改数据库存储过程,返回的Count需先赋值给一变量,最后执行语句时再将变量返回给Count

8.13记住密码,cookie,session存值
//            判断是否记住密码
// string userData = adminInfo.AdminId + "#" + adminInfo.LoginName;
//            //数据放入ticket
//            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, adminInfo.LoginName, DateTime.Now, DateTime.Now.AddMinutes(60), false, userData);
//            //数据加密
//            string enyTicket = FormsAuthentication.Encrypt(ticket);
//            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, enyTicket);
//            System.Web.HttpContext.Current.Response.Cookies.Add(cookie);

//            退出登录
//FormsAuthentication.SignOut();


//            登录跳转Index主页

如果session在的话直接跳转到主页
//            if (UserContext.current.userInfo != null)
//            {
//                return RedirectToAction("Index", "Home");
//            }
//            var cookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
//            if (cookie != null)
//            {
//                //获取存在的cookie
//                var ticket = FormsAuthentication.Decrypt(cookie.Value);
//                string userData = ticket.UserData;
//                if (!string.IsNullOrEmpty(userData))
//                {
//                    //存储在session里面
//                    AdminInfo adminInfo = new AdminInfo();
//                    adminInfo.AdminId = Convert.ToInt32(userData.Split('#')[0]);
//                    adminInfo.LoginName = userData.Split('#')[1];
//                    UserContext.current.userInfo = adminInfo;
//                    return RedirectToAction("Index", "Home");
//                }
//            }
//            return View();

8.21
layui监听做回显含下拉框,复选框等需要重新渲染  
layui.form.render();//需要重新渲染,否则无样式

8.26
SELECT SCOPE_IDENTITY()
语句返回最近新增的自增时,必须和新增语句同一连接时

9.6--服务

1.注意配置文件

2.文件夹不可以自动创建,得先判断是否存在

3.新增Job时,注意修改对应的地方

 

9.7--Autofac框架

1.Autofuc None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructor

实现错误接口,或有接口未实现

2.Circular dependency detected

循环依赖,查看接口是否调用正确,不能自己调自己

3.控制器未定义无参

Global.asax中是否调用注入类,是否设置注入控制器

9.12--EF框架

提示:请确保在应用程序配置文件的“entityFramework”节中注册了该提供程序

UI层未添加引用

 

9.22--IIS新增网站

注意:开启目录浏览

新增everyone权限

本地C:\Windows\System32\drivers\etc\hosts中文件

 

9.23--统一权限后台

前端多个多选框,可将值拼接为对象集合,然后通过JSON.stringify()转为string传过去,后端通过JsonConvert.DeserializeObject<T>转为对象,如传过的值为数据,即含[]

EF框架内部错误,可用try-catch包含错误的地方,查看具体错误

10.1

未找到具有固定名称System.Data.SqlClient的ADO.NET提供程序

未添加EF引用 

将项目部署到码云前,需先清空仓库

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值