小编use*_*653的帖子

在一个页面中以两种不同的形式使用多个@ Html.AntiForgeryToken()是否可能/正确?

我一直面临着严重的问题@Html.AntiForgeryToken().我有一个注册控制器,它有一个创建视图来创建/注册新成员.出于这个原因,我@Html.AntiForgeryToken()在主提交表单中使用了不使用任何SALT.现在我想验证用户名是否已存在于我的用户名文本框的模糊事件数据库中.为了验证,我编写了一个名为"Validation"的新控制器,并编写了一个带有常量验证SALT的方法:

 [HttpPost]
    [ValidateAntiForgeryToken(Salt = @ApplicationEnvironment.SALT)]
    public ActionResult username(string log) {
        try {
            if (log == null || log.Length < 3)
                return Json(log, JsonRequestBehavior.AllowGet);

            var member = Membership.GetUser(log);

            if (member == null) {
                //string userPattern = @"^([a-zA-Z])[a-zA-Z_-]*[\w_-]*[\S]$|^([a-zA-Z])[0-9_-]*[\S]$|^[a-zA-Z]*[\S]$";
                string userPattern = "[A-Za-z][A-Za-z0-9._]{3,80}";
                if (Regex.IsMatch(log, userPattern))
                    return Json(log, JsonRequestBehavior.AllowGet);
            }

        } catch (Exception ex) {
            CustomErrorHandling.HandleErrorByEmail(ex, "Validate LogName()");
            return Json(log, JsonRequestBehavior.AllowGet);
        }
        //found e false
        return Json(log, JsonRequestBehavior.AllowGet);

    }
Run Code Online (Sandbox Code Playgroud)

方法工作正常.我已经检查过HTTP Get annotation而没有[ValidateAntiForgeryToken]得到预期的结果.

我用谷歌搜索并检查了许多给定的解决方案,这些解决方案都没有.对于我的验证控制器,我在同一页面中使用了另一个表单,并在Anti-forgery令牌中使用了SALT.

示例:主提交表单的第一个防伪标记:

@using(Html.BeginForm("Create","Register")){@ Html.AntiForgeryToken()@ …

asp.net-mvc jquery json antiforgerytoken asp.net-mvc-3

10
推荐指数
1
解决办法
8651
查看次数

Crystal Reports会一直提示参数

我在.net 4.0的水晶报告2010中遇到了一个可怕的问题(我使用的是固定的13.0.1版本,但是发布了13.0.4).无论我尝试哪种方式,我总是会得到一个提示对话框,以便第一次输入我的一个参数值.

CrystalReportViewer1.ReportSource = CustomerReport1;    
CustomerReport1.Database.Tables[0].SetDatasource ( this.dataset);        
CustomerReport1.SetParameterValue("PathLocation", Location.Text);

CustomerReport1.Parameter_PathLocation.CurrentValues.Add(Location.Text) // to be safe using CS 2010 for .net 4
CrystalReportViewer1.ReuseReportParametersOnRefresh = true; // to prevent from showing again and again.
Run Code Online (Sandbox Code Playgroud)

我也试过这个:

CustomerReport1.Database.Tables[0].SetDatasource ( this.dataset);        
CustomerReport1.SetParameterValue("PathLocation", Location.Text);

CrystalReportViewer1.ReportSource = CustomerReport1;
Run Code Online (Sandbox Code Playgroud)

还有这个:

CustomerReport1.Database.Tables[0].SetDatasource ( this.dataset);        
CustomerReport1.Parameter_PathLocation.CurrentValues.Add(Location.Text)

CrystalReportViewer1.ReportSource = CustomerReport1; // the parameter in the report has Optional Parameter = false, Static , Multiple Value = false .
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?我对此感到沮丧.它在以前的版本中有效,但现在我收到了这个提示框.

谢谢.

c# vb.net crystal-reports crystal-reports-2010 c#-4.0

4
推荐指数
1
解决办法
9095
查看次数

是否可以将任何碱基转化为任何碱基(范围2至46)

我知道将任何基地转换为任何基地都很简单.首先,将任何base转换为decimal,然后将decimal转换为任何其他base.但是,我之前已经完成了2到36的范围,但从未完成2到46.

我不明白我将在36之后放什么,因为36表示'z'(1-10是十进制数字,然后是字母表的26个字符).

请解释36后会发生什么.

algorithm math

3
推荐指数
2
解决办法
5138
查看次数

EntityFramework:IQueryable或IEnumerable会在第一时间获得所有结果吗?

我了解到IQueryable或IEnumerable数据类型不会在第一时间返回结果,只在需要时返回它们.然而,当我在手表检查员中打开那个物体时,我看到所有的物体都在那里.

我的代码是否有任何问题,或只是因为我在手表上调用它而显示?

[当我在监视对话框中查看pendings对象时,我看到了所有列表项,但它不应该在第一个位置加载.我的接近是否有什么问题,或者只是因为我在手表上看到它而显示出来.

 public IQueryable<PurchasePendingView> PurchasePendings() {
            var pendings = db.PurchasePendingViews
                             .Where(m => m.AccountStatusID != StructAccountStatus.Succeed); // when I view it in the watch dialougebox I saw all the list items but it shouldn't load at the first place. Is there anything wrong in my approaching or is it just showing because I had call it on the watch. 
            if (ApplicationEnvironment.DEBUGGING) {
                return pendings;
            } else if (IsMobileAccount()) {
                var showroom = db.ShowRooms.FirstOrDefault(m=> m.MemberID == employee.MemberID);
                if (showroom …
Run Code Online (Sandbox Code Playgroud)

c# linq-to-entities entity-framework linq-to-sql entity-framework-4

1
推荐指数
1
解决办法
1474
查看次数