IWebHelper.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace GreenTree.Nachtragsmanagement.Core
  7. {
  8. /// <summary>
  9. /// Represents a common helper
  10. /// </summary>
  11. public partial interface IWebHelper
  12. {
  13. /// <summary>
  14. /// Get URL referrer
  15. /// </summary>
  16. /// <returns>URL referrer</returns>
  17. string GetUrlReferrer();
  18. /// <summary>
  19. /// Get context IP address
  20. /// </summary>
  21. /// <returns>URL referrer</returns>
  22. string GetCurrentIpAddress();
  23. /// <summary>
  24. /// Gets this page name
  25. /// </summary>
  26. /// <param name="includeQueryString">Value indicating whether to include query strings</param>
  27. /// <returns>Page name</returns>
  28. string GetThisPageUrl(bool includeQueryString);
  29. /// <summary>
  30. /// Gets this page name
  31. /// </summary>
  32. /// <param name="includeQueryString">Value indicating whether to include query strings</param>
  33. /// <param name="useSsl">Value indicating whether to get SSL protected page</param>
  34. /// <returns>Page name</returns>
  35. string GetThisPageUrl(bool includeQueryString, bool useSsl);
  36. /// <summary>
  37. /// Gets a value indicating whether current connection is secured
  38. /// </summary>
  39. /// <returns>true - secured, false - not secured</returns>
  40. bool IsCurrentConnectionSecured();
  41. /// <summary>
  42. /// Gets server variable by name
  43. /// </summary>
  44. /// <param name="name">Name</param>
  45. /// <returns>Server variable</returns>
  46. string ServerVariables(string name);
  47. /// <summary>
  48. /// Maps a virtual path to a physical disk path.
  49. /// </summary>
  50. /// <param name="path">The path to map. E.g. "~/bin"</param>
  51. /// <returns>The physical path. E.g. "c:\inetpub\wwwroot\bin"</returns>
  52. string MapPath(string path);
  53. /// <summary>
  54. /// Modifies query string
  55. /// </summary>
  56. /// <param name="url">Url to modify</param>
  57. /// <param name="queryStringModification">Query string modification</param>
  58. /// <param name="anchor">Anchor</param>
  59. /// <returns>New url</returns>
  60. string ModifyQueryString(string url, string queryStringModification, string anchor);
  61. /// <summary>
  62. /// Remove query string from url
  63. /// </summary>
  64. /// <param name="url">Url to modify</param>
  65. /// <param name="queryString">Query string to remove</param>
  66. /// <returns>New url</returns>
  67. string RemoveQueryString(string url, string queryString);
  68. /// <summary>
  69. /// Gets query string value by name
  70. /// </summary>
  71. /// <typeparam name="T"></typeparam>
  72. /// <param name="name">Parameter name</param>
  73. /// <returns>Query string value</returns>
  74. T QueryString<T>(string name);
  75. /// <summary>
  76. /// Restart application domain
  77. /// </summary>
  78. /// <param name="makeRedirect">A value indicating whether we should made redirection after restart</param>
  79. /// <param name="redirectUrl">Redirect URL; empty string if you want to redirect to the current page URL</param>
  80. void RestartAppDomain(bool makeRedirect = false, string redirectUrl = "");
  81. /// <summary>
  82. /// Gets a value that indicates whether the client is being redirected to a new location
  83. /// </summary>
  84. bool IsRequestBeingRedirected { get; }
  85. /// <summary>
  86. /// Gets or sets a value that indicates whether the client is being redirected to a new location using POST
  87. /// </summary>
  88. bool IsPostBeingDone { get; set; }
  89. }
  90. }