为什么Web API身份验证不起作用?

时间:2017-07-18 11:41:32

标签: asp.net-web-api

我在这里使用Web API身份验证来检查针对我的数据库的用户凭据。我在Repo.cs文件中写了一个条件:

// foreach series --> load series details & seasons, foreach season --> load episodes
// when all requests are completed: do something

var requests = []

// e.g. series = [1]
series.forEach(function(seriesId) {
    requests.push(loadSeriesDetails(seriesId).then(function(data) {
        console.log("received details for series "+seriesId)
        // e.g. {id:1, title:"show 1"}
    }))
    requests.push(loadSeasons(seriesId).then(function (data) {
        console.log("received seasons for series "+seriesId+": ", data.seasons.length)
        // e.g. [{id:11, title:"season 1"}, {id:12, title:"season 2"}]
        var innerRequests = [] // <<<==============
        data.seasons.map(function(e) {return e.id}).forEach(function(seasonId) {
            innerRequests.push(loadEpisodes(seasonId).then(function (data) {
                console.log("received episodes for season "+seasonId+": ", data.episodes.length)
                // e.g.
                // season 11: [{id:111, title:"episode 1-1-1"}, {id:112, title:"episode 1-1-2"}, {id:113, title:"episode 1-1-3"}]
                // season 12: [{id:121, title:"episode 1-2-1"}, {id:122, title:"episode 1-2-2"}]
            }))
        })
        return $q.all(innerRequests) //  <<<==============
    }))
})

$q.all(requests).then(function(result) {
    console.log("*** all requests completed ***")
    console.log(result.length)
})

我有一个名为public bool EmailValidation(string UserName, string password) { var x = (from n in db.LoginCrediential where n.UserName == UserName && n.Password == password select n); if (x != null) return true; else return false; } 的类文件。当我输入凭据对我的数据库它接受我的详细信息,但为什么它不在我的if条件内移动?

MyAuthorizationServerProvider

0 个答案:

没有答案