public HttpResponseMessage Contactz()
{
var data = new List();
data.Add("abc");
data.Add("abc");
data.Add("abc");
data.Add("abc");
return new HttpResponseMessage
{
Content = new StringContent(JArray.FromObject(data).ToString(), Encoding.UTF8, "application/json")
};
}
Saturday, September 19, 2015
Return Dynamic Object From Web Api
Wednesday, September 9, 2015
MVC Custom Authetication
public class HomeController : Controller
{
[CustomRole]
public ActionResult Index()
{
return View();
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
public class CustomRole : AuthorizeAttribute
{
protected override bool AuthorizeCore(HttpContextBase context)
{
//Call from db
var a = 3;
if (a==2)
{
return true;
}
else { return false; }
}
}
Subscribe to:
Comments (Atom)