IWebHelper.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 a value indicating whether current connection is secured
  25. /// </summary>
  26. /// <returns>true - secured, false - not secured</returns>
  27. bool IsCurrentConnectionSecured();
  28. /// <summary>
  29. /// Gets server variable by name
  30. /// </summary>
  31. /// <param name="name">Name</param>
  32. /// <returns>Server variable</returns>
  33. string ServerVariables(string name);
  34. /// <summary>
  35. /// Maps a virtual path to a physical disk path.
  36. /// </summary>
  37. /// <param name="path">The path to map. E.g. "~/bin"</param>
  38. /// <returns>The physical path. E.g. "c:\inetpub\wwwroot\bin"</returns>
  39. string MapPath(string path);
  40. /// <summary>
  41. /// Modifies query string
  42. /// </summary>
  43. /// <param name="url">Url to modify</param>
  44. /// <param name="queryStringModification">Query string modification</param>
  45. /// <param name="anchor">Anchor</param>
  46. /// <returns>New url</returns>
  47. string ModifyQueryString(string url, string queryStringModification, string anchor);
  48. /// <summary>
  49. /// Remove query string from url
  50. /// </summary>
  51. /// <param name="url">Url to modify</param>
  52. /// <param name="queryString">Query string to remove</param>
  53. /// <returns>New url</returns>
  54. string RemoveQueryString(string url, string queryString);
  55. /// <summary>
  56. /// Gets query string value by name
  57. /// </summary>
  58. /// <typeparam name="T"></typeparam>
  59. /// <param name="name">Parameter name</param>
  60. /// <returns>Query string value</returns>
  61. T QueryString<T>(string name);
  62. /// <summary>
  63. /// Restart application domain
  64. /// </summary>
  65. /// <param name="makeRedirect">A value indicating whether we should made redirection after restart</param>
  66. /// <param name="redirectUrl">Redirect URL; empty string if you want to redirect to the current page URL</param>
  67. void RestartAppDomain(bool makeRedirect = false, string redirectUrl = "");
  68. /// <summary>
  69. /// Gets a value that indicates whether the client is being redirected to a new location
  70. /// </summary>
  71. bool IsRequestBeingRedirected { get; }
  72. /// <summary>
  73. /// Gets or sets a value that indicates whether the client is being redirected to a new location using POST
  74. /// </summary>
  75. bool IsPostBeingDone { get; set; }
  76. }
  77. }