Guest User

Untitled

a guest
Jun 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
  2. at System.Guid.TryParseGuidWithNoStyle
  3. at System.Guid.TryParseGuid
  4. at System.Guid..ctor
  5. at System.DirectoryServices.AccountManagement.ADStoreCtx.IdentityClaimToFilter
  6.  
  7. public object WebRequest<T>(string controller, Dictionary<string, string> parameters, Method apiMethod, string action)
  8. {
  9. RestClient client = new RestClient(Url + controller + "/");
  10. client.Authenticator = new NtlmAuthenticator();
  11. RestRequest request = new RestRequest(action, apiMethod);
  12.  
  13. if (parameters != null && parameters.Count > 0)
  14. {
  15. foreach (var parameter in parameters)
  16. {
  17. request.AddParameter(parameter.Key, parameter.Value);
  18. }
  19. }
  20.  
  21. object result = JsonToObject<T>(client.Execute(request).Content);
  22.  
  23. return result;
  24. }
  25.  
  26. @helper Username()
  27. {
  28. PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
  29.  
  30. var username = System.Web.HttpContext.Current.User.Identity.Name.Replace(@"GIRLINGS", "");
  31.  
  32. @username
  33. }
  34.  
  35. @helper UserFullName()
  36. {
  37. using (var context = new PrincipalContext(ContextType.Domain))
  38. {
  39. var principal = UserPrincipal.FindByIdentity(context, User.Identity.Name);
  40. if (principal != null)
  41. {
  42. var fullName = string.Format("{0}", principal.DisplayName);
  43. @fullName
  44. }
  45. }
  46. }
Add Comment
Please, Sign In to add comment