Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. namespace ComputerSite.Controllers
  2. {
  3. public class HomeController : Controller
  4. {
  5. public ActionResult Index()
  6. {
  7. return View();
  8. }
  9.  
  10. <!DOCTYPE html>
  11. <html>
  12. <head>
  13. <meta charset="utf-8" />
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  15. <title>@ViewBag.Title - Computers for you!</title>
  16. @Styles.Render("~/Content/boot")
  17. @Scripts.Render("~/bundles/modernizr")
  18.  
  19. @Scripts.Render("~/bundles/jquery")
  20. @Scripts.Render("~/bundles/jqueryval")
  21. @Scripts.Render("~/bundles/ajaxgroup")
  22. @Scripts.Render("~/bundles/bootstrap")
  23. @Scripts.Render("~/bundles/datatables")
  24. @Scripts.Render("~/bundles/tawk")
  25. @if (Request.IsAuthenticated)
  26. {
  27. string text = UserHelper.GetUserEmail(User.Identity.Name), key = "MY APIKEY";
  28. System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
  29.  
  30. Byte[] textBytes = encoding.GetBytes(text);
  31. Byte[] keyBytes = encoding.GetBytes(key);
  32.  
  33. Byte[] hashBytes;
  34.  
  35. using (System.Security.Cryptography.HMACSHA256 hash = new System.Security.Cryptography.HMACSHA256(keyBytes)) { hashBytes = hash.ComputeHash(textBytes); }
  36.  
  37. string hashTxt = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
  38.  
  39. <script type="text/javascript">
  40. Tawk_API.onLoad = function(){
  41. Tawk_API.setAttributes({
  42. 'name' : '@User.Identity.Name',
  43. 'email': '@UserHelper.GetUserEmail(User.Identity.Name)',
  44. 'hash': '@hashTxt'
  45. }, function (error) {});
  46.  
  47. };
  48. </script>
  49. }
  50. @RenderSection("scripts", required: false)
  51. </head>
  52. <body>
  53. @{ Html.RenderPartial("_navBar"); }
  54. <div class="container body-content">
  55. @RenderBody()
  56. <hr />
  57. <footer>
  58. <p>&copy; @DateTime.Now.Year - Building computer for you by you!</p>
  59. </footer>
  60. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement