c# - How to set header value in asp.net web api -


i want able set header value/secret key in asp.net web api, can not use web service except or has secret key, , also, if set on api side, how user retrieves value/secret key on client side , use while consuming service.

i have tried this, not sure whether right. below code:

public iqueryable<paymentapi> getpaymentapi()    {        var re = request;        var headers = re.headers;        if(headers.contains("rtyuiopjhfghjuiopjklkljh"))        {            return db.paymentapi;        }        return null;    } 

thanks response.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -