public static string DeleteKey(string Key) { string msg = ""; HttpContext context = HttpContext.Current; if (context.User.Identity.IsAuthenticated) { try { vwar.service.host.APIKeyManager keyMan = new vwar.service.host.APIKeyManager(); if (keyMan.GetUserByKey(Key).Equals(context.User.Identity.Name)) { keyMan.DeleteKey(Key); msg = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyDeleteSuccess"]; } else { msg = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyDeleteError"]; } } catch { msg = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyDeleteError"]; } } else { context.Response.StatusCode = 401; } return(msg); }
public static string DeleteKey(string Key) { string msg = ""; HttpContext context = HttpContext.Current; if (context.User.Identity.IsAuthenticated) { try { vwar.service.host.APIKeyManager keyMan = new vwar.service.host.APIKeyManager(); if (keyMan.GetUserByKey(Key).Equals(context.User.Identity.Name)) { keyMan.DeleteKey(Key); msg = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyDeleteSuccess"]; } else { msg = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyDeleteError"]; } } catch { msg = System.Configuration.ConfigurationManager.AppSettings["ProfilePage_KeyDeleteError"]; } } else { context.Response.StatusCode = 401; } return msg; }