c# - How to get referrer data in a Custom Authorize Attribute in ASP.NET -
how referrer data ip address , apikey in custom authorize attribute in asp.net. in code below i'd data mentioned above:
[attributeusage(attributetargets.method)] public class auth : authorizeattribute { protected override bool isauthorized(httpactioncontext actioncontext) { var cnt = httpcontext.current; return false; } }
in httpcontext.current can url referrer doesn't have data need.
please let me know if question unclear or incomplete.
update: need know, code below shows how.
[attributeusage(attributetargets.method)] public class auth : authorizeattribute { protected override bool isauthorized(httpactioncontext actioncontext) { var cnt = httpcontext.current; int id = int32.parse(cnt.request.params["id"]); string apikey = cnt.request.params["apikey"]; string ip = httpcontext.current.request.servervariables["remote_addr"]; return true; } }
Comments
Post a Comment