小编Wan*_*Dan的帖子

如何在导航属性上将 IsModified 设置为 false

我有ArticleApplicationUser模型类:

public class ApplicationUser
{
    ...

}

public class Article
{
    ...

    public ApplicationUser CreatedBy { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我试图通过这种方式将 CreatedBy 属性设置为 false:

base.Entry(entity).Property(x => x.CreatedBy).IsModified = false;
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

正在使用“Property”方法访问实体类型“ApplicationUser”上的“CreatedBy”属性,但在模型中将其定义为导航属性。使用“Reference”或“Collection”方法访问导航属性。

c# entity-framework-core asp.net-core

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

发出ajax发布请求时出现403禁止错误

我的代码在localhost(垃圾服务器)上运行良好,但是将其移至共享主机后,出现错误403(禁止)。我首先尝试了这个:

    $.post('login.php?login', { user_email: user_email, user_password: user_password, user_remember: user_remember }, function(data)
    {
     // Some code here
    }
Run Code Online (Sandbox Code Playgroud)

然后我尝试了这个:

var http = new XMLHttpRequest();
var url = "login.php?login";
var params = "user_email="+user_email+"&user_password="+user_password+"&user_remember="+user_remember;
http.open("POST", url, true);

http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

http.onreadystatechange = function() {
    if(http.readyState == 4 && http.status == 200) {
        // Some code here
    }
}
http.send(params);
Run Code Online (Sandbox Code Playgroud)

但我仍然收到此错误:

POST http://domain_name/login.php?login 403(禁止)

知道怎么了吗?

javascript php ajax xmlhttprequest

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