.net 5.0获取客户端IP

相关视频教程 https://www.bilibili.com/video/BV1LM4y1V7Am(如果不会请看我录制的视频教程

1、在Startup类里面 注册服务,如下图


services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();


2、在控制器里面获取ip 方法如下


HttpContextAccessor context = new HttpContextAccessor();
string ip = context.HttpContext?.Connection.RemoteIpAddress.ToString();
ViewData["ip"] = ip;


评论

  1. 82.102.31.*2021-09-15 17:41:13
    e

  2. 82.102.31.*2021-09-15 17:39:22
    @@umQOO

  3. 82.102.31.*2021-09-15 17:39:21
    1'"

  4. 82.102.31.*2021-09-15 17:39:20
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

  5. 82.102.31.*2021-09-15 17:39:16
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

  6. 82.102.31.*2021-09-15 17:39:13
    uvrb2FlR')) OR 864=(SELECT 864 FROM PG_SLEEP(15))--

  7. 82.102.31.*2021-09-15 17:39:08
    jzBLqM8Q') OR 886=(SELECT 886 FROM PG_SLEEP(15))--

  8. 82.102.31.*2021-09-15 17:39:04
    A1NB3QJz' OR 93=(SELECT 93 FROM PG_SLEEP(15))--

  9. 82.102.31.*2021-09-15 17:39:00
    -1)) OR 409=(SELECT 409 FROM PG_SLEEP(15))--

  10. 82.102.31.*2021-09-15 17:38:56
    -5) OR 424=(SELECT 424 FROM PG_SLEEP(15))--

  11. 82.102.31.*2021-09-15 17:38:51
    -5 OR 44=(SELECT 44 FROM PG_SLEEP(15))--

  12. 82.102.31.*2021-09-15 17:38:45
    VApywctx')); waitfor delay '0:0:15' --

  13. 82.102.31.*2021-09-15 17:38:40
    8N2nBtyW'); waitfor delay '0:0:15' --

  14. 82.102.31.*2021-09-15 17:38:35
    P4tnX2Mr'; waitfor delay '0:0:15' --

  15. 82.102.31.*2021-09-15 17:38:30
    1 waitfor delay '0:0:15' --

  16. 82.102.31.*2021-09-15 17:38:27
    -1)); waitfor delay '0:0:15' --

  17. 82.102.31.*2021-09-15 17:38:23
    -1); waitfor delay '0:0:15' --

  18. 82.102.31.*2021-09-15 17:38:18
    -1; waitfor delay '0:0:15' --

  19. 82.102.31.*2021-09-15 17:38:14
    e

  20. 82.102.31.*2021-09-15 17:38:13
    e

  21. 82.102.31.*2021-09-15 17:38:13
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

  22. 82.102.31.*2021-09-15 17:38:12
    e

  23. 82.102.31.*2021-09-15 17:38:09
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

  24. 82.102.31.*2021-09-15 17:38:07
    e

  25. 82.102.31.*2021-09-15 17:38:04
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

  26. 82.102.31.*2021-09-15 17:38:01
    e

  27. 82.102.31.*2021-09-15 17:37:59
    if(now()=sysdate(),sleep(15),0)

  28. 82.102.31.*2021-09-15 17:37:56
    e

  29. 82.102.31.*2021-09-15 17:37:54
    -1" OR 3*2>(0+5+815-815) --

  30. 82.102.31.*2021-09-15 17:37:53
    -1" OR 3+815-815-1=0+0+0+1 --

  31. 82.102.31.*2021-09-15 17:37:53
    -1" OR 3*2<(0+5+815-815) --

  32. 82.102.31.*2021-09-15 17:37:52
    -1' OR 3*2>(0+5+596-596) or 'hzE8y96K'='

  33. 82.102.31.*2021-09-15 17:37:52
    e

  34. 82.102.31.*2021-09-15 17:37:52
    -1" OR 2+815-815-1=0+0+0+1 --

  35. 82.102.31.*2021-09-15 17:37:51
    -1' OR 3+596-596-1=0+0+0+1 or 'hzE8y96K'='

  36. 82.102.31.*2021-09-15 17:37:51
    -1' OR 3*2<(0+5+596-596) or 'hzE8y96K'='

  37. 82.102.31.*2021-09-15 17:37:49
    -1' OR 2+596-596-1=0+0+0+1 or 'hzE8y96K'='

  38. 82.102.31.*2021-09-15 17:37:48
    -1' OR 3*2>(0+5+751-751) --

  39. 82.102.31.*2021-09-15 17:37:47
    -1' OR 3+751-751-1=0+0+0+1 --

  40. 82.102.31.*2021-09-15 17:37:47
    e

  41. 82.102.31.*2021-09-15 17:37:47
    -1' OR 3*2<(0+5+751-751) --

  42. 82.102.31.*2021-09-15 17:37:46
    -1 OR 3*2>(0+5+38-38)

  43. 82.102.31.*2021-09-15 17:37:46
    -1' OR 2+751-751-1=0+0+0+1 --

  44. 82.102.31.*2021-09-15 17:37:45
    -1 OR 3*2<(0+5+38-38)

  45. 82.102.31.*2021-09-15 17:37:44
    -1 OR 2+38-38-1=0+0+0+1

  46. 82.102.31.*2021-09-15 17:37:44
    -1 OR 3+38-38-1=0+0+0+1

  47. 82.102.31.*2021-09-15 17:37:43
    -1 OR 3*2<(0+5+344-344) --

  48. 82.102.31.*2021-09-15 17:37:43
    -1 OR 3*2>(0+5+344-344) --

  49. 82.102.31.*2021-09-15 17:37:42
    e

  50. 82.102.31.*2021-09-15 17:37:42
    -1 OR 3+344-344-1=0+0+0+1 --

  51. 82.102.31.*2021-09-15 17:37:41
    -1 OR 2+344-344-1=0+0+0+1 --

  52. 82.102.31.*2021-09-15 17:37:40
    1

  53. 82.102.31.*2021-09-15 17:37:36
    e

  54. 82.102.31.*2021-09-15 17:37:35
    1

  55. 82.102.31.*2021-09-15 17:37:31
    e

  56. 82.102.31.*2021-09-15 17:37:26
    e

  57. 82.102.31.*2021-09-15 17:37:22
    e

  58. 82.102.31.*2021-09-15 17:37:17
    e

  59. 82.102.31.*2021-09-15 17:37:12
    e

  60. 82.102.31.*2021-09-15 17:37:12
    e

  61. 82.102.31.*2021-09-15 17:37:11
    e

  62. 82.102.31.*2021-09-15 17:37:11
    e

  63. 82.102.31.*2021-09-15 17:37:10
    e

  64. 82.102.31.*2021-09-15 17:37:09
    e

  65. 82.102.31.*2021-09-15 17:37:09
    e

  66. 82.102.31.*2021-09-15 17:37:08
    e

  67. 82.102.31.*2021-09-15 17:37:08
    e

  68. 82.102.31.*2021-09-15 17:37:07
    e

  69. 82.102.31.*2021-09-15 17:37:07
    e

  70. 82.102.31.*2021-09-15 17:37:06
    e

  71. 82.102.31.*2021-09-15 17:37:05
    e

  72. 82.102.31.*2021-09-15 17:37:05
    e

  73. 82.102.31.*2021-09-15 17:37:04
    e

  74. 82.102.31.*2021-09-15 17:37:04
    e

  75. 82.102.31.*2021-09-15 17:37:03
    e

  76. 82.102.31.*2021-09-15 17:37:03
    e

  77. 82.102.31.*2021-09-15 17:37:02
    e

  78. 82.102.31.*2021-09-15 17:37:02
    e

  79. 82.102.31.*2021-09-15 17:37:01
    e

  80. 82.102.31.*2021-09-15 17:36:55
    e

  81. 82.102.31.*2021-09-15 17:36:48
    @@P8utb

  82. 82.102.31.*2021-09-15 17:36:47
    1'"

  83. 82.102.31.*2021-09-15 17:36:46
    e'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

  84. 82.102.31.*2021-09-15 17:36:41
    iXnlpz3S')) OR 505=(SELECT 505 FROM PG_SLEEP(15))--

  85. 82.102.31.*2021-09-15 17:36:36
    3ItbE8gY') OR 807=(SELECT 807 FROM PG_SLEEP(15))--

  86. 82.102.31.*2021-09-15 17:36:32
    gIXspeXm' OR 57=(SELECT 57 FROM PG_SLEEP(15))--

  87. 82.102.31.*2021-09-15 17:36:28
    7NGptEFO')); waitfor delay '0:0:15' --

  88. 82.102.31.*2021-09-15 17:36:22
    SBOEe8jz'); waitfor delay '0:0:15' --

  89. 82.102.31.*2021-09-15 17:36:17
    AUo7Uxru'; waitfor delay '0:0:15' --

  90. 82.102.31.*2021-09-15 17:36:12
    1 waitfor delay '0:0:15' --

  91. 82.102.31.*2021-09-15 17:36:06
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

  92. 82.102.31.*2021-09-15 17:36:01
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

  93. 82.102.31.*2021-09-15 17:35:56
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

  94. 82.102.31.*2021-09-15 17:35:50
    if(now()=sysdate(),sleep(15),0)

  95. 82.102.31.*2021-09-15 17:35:45
    -1" OR 3*2>(0+5+232-232) --

  96. 82.102.31.*2021-09-15 17:35:44
    -1" OR 3+232-232-1=0+0+0+1 --

  97. 82.102.31.*2021-09-15 17:35:44
    -1" OR 3*2<(0+5+232-232) --

  98. 82.102.31.*2021-09-15 17:35:43
    -1' OR 3*2>(0+5+214-214) or 'T5RVIYqu'='

  99. 82.102.31.*2021-09-15 17:35:43
    -1" OR 2+232-232-1=0+0+0+1 --

  100. 82.102.31.*2021-09-15 17:35:42
    -1' OR 3*2<(0+5+214-214) or 'T5RVIYqu'='

  101. 82.102.31.*2021-09-15 17:35:41
    -1' OR 2+214-214-1=0+0+0+1 or 'T5RVIYqu'='

  102. 82.102.31.*2021-09-15 17:35:41
    -1' OR 3+214-214-1=0+0+0+1 or 'T5RVIYqu'='

  103. 82.102.31.*2021-09-15 17:35:40
    -1' OR 3*2<(0+5+146-146) --

  104. 82.102.31.*2021-09-15 17:35:40
    -1' OR 3*2>(0+5+146-146) --

  105. 82.102.31.*2021-09-15 17:35:39
    -1' OR 2+146-146-1=0+0+0+1 --

  106. 82.102.31.*2021-09-15 17:35:39
    -1' OR 3+146-146-1=0+0+0+1 --

  107. 82.102.31.*2021-09-15 17:35:38
    -1 OR 3*2<(0+5+714-714)

  108. 82.102.31.*2021-09-15 17:35:38
    -1 OR 3*2>(0+5+714-714)

  109. 82.102.31.*2021-09-15 17:35:37
    -1 OR 3+714-714-1=0+0+0+1

  110. 82.102.31.*2021-09-15 17:35:36
    -1 OR 3*2>(0+5+121-121) --

  111. 82.102.31.*2021-09-15 17:35:36
    -1 OR 2+714-714-1=0+0+0+1

  112. 82.102.31.*2021-09-15 17:35:35
    -1 OR 3+121-121-1=0+0+0+1 --

  113. 82.102.31.*2021-09-15 17:35:35
    -1 OR 3*2<(0+5+121-121) --

  114. 82.102.31.*2021-09-15 17:35:34
    -1 OR 2+121-121-1=0+0+0+1 --

  115. 82.102.31.*2021-09-15 17:35:33
    e

  116. 82.102.31.*2021-09-15 17:35:27
    e

  117. 82.102.31.*2021-09-15 17:33:57
    e

  118. 82.102.31.*2021-09-15 17:33:51
    e

  119. 82.102.31.*2021-09-15 17:32:04
    e

  120. 82.102.31.*2021-09-15 17:31:55
    e

  121. 82.102.31.*2021-09-15 17:31:19
    e

  122. 113.245.37.*2021-08-24 11:39:37
    测试