Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // updated: 03-04-2013
- //
- using System.Web;
- public static class Mashape // www.mashape.com/priore
- {
- private static string[] VALID_MASHAPE_ADDR = new string[] { "23.21.64.131", "23.21.68.63", "23.23.86.71", "23.23.87.232", "23.23.103.203", "23.23.103.204", "23.23.103.207", "23.23.103.212", "23.23.103.218", "50.17.255.165" };
- public static bool IsValidSecretCode(string secret_code)
- {
- HttpContext context = HttpContext.Current;
- if (context == null)
- throw new ArgumentException("Invalid HTTP Context!");
- return IsValidSecretCode(secret_code, context);
- }
- public static bool IsValidSecretCode(string secret_code, HttpContext context)
- {
- string keySecret = "HTTP_X_MASHAPE_PROXY_SECRET:" + secret_code;
- string tagSubscr = "HTTP_X_MASHAPE_SUBSCRIPTION:";
- HttpRequest request = context.Request;
- string remote_addr = request.ServerVariables["REMOTE_ADDR"];
- string all_http = request.ServerVariables["ALL_HTTP"];
- return VALID_MASHAPE_ADDR.Contains(remote_addr) && all_http.Contains(keySecret) && all_http.Contains(tagSubscr);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement