public CreateKey ( string email, string usage ) : |
||
string | ||
usage | string | |
return |
public static Hashtable RequestKey(string Description) { System.Collections.Hashtable ht = new System.Collections.Hashtable(); HttpContext context = HttpContext.Current; if (context.User.Identity.IsAuthenticated) { try { vwar.service.host.APIKeyManager keyMan = new vwar.service.host.APIKeyManager(); vwar.service.host.APIKey key = keyMan.CreateKey(context.User.Identity.Name, context.Server.HtmlEncode(Description)); ht["Key"] = key.Key; ht["Usage"] = key.Usage; ht["Active"] = (key.State == vwar.service.host.APIKeyState.ACTIVE) ? "Yes" : "No"; ht["Message"] = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyRequestSuccess"]; } catch { ht["Message"] = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyRequestError"]; } } else { ht["Message"] = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyRequestError"]; } return(ht); }
public static Hashtable RequestKey(string Description) { System.Collections.Hashtable ht = new System.Collections.Hashtable(); HttpContext context = HttpContext.Current; if (context.User.Identity.IsAuthenticated) { try { vwar.service.host.APIKeyManager keyMan = new vwar.service.host.APIKeyManager(); vwar.service.host.APIKey key = keyMan.CreateKey(context.User.Identity.Name, context.Server.HtmlEncode(Description)); ht["Key"] = key.Key; ht["Usage"] = key.Usage; ht["Active"] = (key.State == vwar.service.host.APIKeyState.ACTIVE) ? "Yes" : "No"; ht["Message"] = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyRequestSuccess"]; } catch { ht["Message"] = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyRequestError"]; } } else { ht["Message"] = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyRequestError"]; } return ht; }