27 Eylül 2017 Çarşamba

Web Api ActionFilterAttribute

public class Auth : ActionFilterAttribute
{
public string token { get; set; }
public override void OnActionExecuting(HttpActionContext actionContext)
{
base.OnActionExecuting(actionContext);

var id = actionContext.ActionArguments["token"] as string;
if (id != "1")
{
actionContext.Response = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.Unauthorized);
}

}
}




[Auth]
public IEnumerable<string> Get(string token)
{
return new string[] { "value1", "value2" };
}

JavaScript

JavaScript Nedir?    JavaScript web tabanlı bir programlama dilidir. Mayıs 1995 yılında Brendan Eich tarafından tasarlanmıştır. Kullanıcı et...