0
我有我的控制器飾:BasicAuthentication] - 然而,投入斷點,並逐句通過代碼時,[BasicAuthentication]從來沒有重定向到Auth.cs(在過濾器文件夾):BasicAuthentication不會在Auth.cs中調用我的OnActionExecuting - 我可能錯過了什麼?
過濾器\驗證.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.Security;
namespace ebapi.Filter
{
public class BasicAuthenticationAttribute : System.Web.Http.Filters.ActionFilterAttribute
{
public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
{
所以重寫OnActionExecuting永遠不會執行 - 但我看不到我錯過了什麼。我的控制器,飾以[BasicAuthentication]如下所示,但不會調用上面顯示我的Auth.cs:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using ebapi.Filter;
using ebapi.Models;
namespace ebapi.Controllers
{
public class GetBookingsController : ApiController
{
private GetBookingsContext db = new GetBookingsContext();
private ApiMembersContext dba = new ApiMembersContext();
// GET api/GetBookings/5
[BasicAuthentication]
public IEnumerable<GetBooking> GetBooking(long id)
{
感謝您的幫助,
馬克
將在瀏覽器緩存中可能有什麼關係呢?如果是這樣,是否有任何事情來確保它在每個帖子/獲取中被重新檢查? – Mark