[英]IIS Rewrite Provider : How to log requested URL?
I have IIS 10 running on Windows Server 2019我在 Windows 服务器 2019 上运行 IIS 10
I'm rewriting some URL's using a provider written in.Net我正在使用用.Net 编写的提供程序重写一些 URL
I would like to log all the URL requests sent to this provider.我想记录所有发送给该提供商的 URL 请求。 Is that possible please?请问这可能吗?
For example if the provider receives "/url?parameter=x", I would like this string to be saved.例如,如果提供者收到“/url?parameter=x”,我希望保存这个字符串。
Can anyone help please?有人可以帮忙吗?
Thanks谢谢
Here is my code这是我的代码
Partial Public Class URLManager
Implements IRewriteProvider
Implements IProviderDescriptor
Public Function IRewriteProvider_Rewrite(Value As String) As String Implements IRewriteProvider.Rewrite
Dim Output as string
'Do some processing of the requested URL
Output = Process(Value)
Return Output
End Function
Public Iterator Function IProviderDescriptor_GetSettings() As IEnumerable(Of SettingDescriptor) Implements IProviderDescriptor.GetSettings
Yield New SettingDescriptor("MainApplication", "Main Application Identifier")
End Function
Public Sub IRewriteProvider_Initialize(settings As IDictionary(Of String, String), rewriteContext As IRewriteContext) Implements IRewriteProvider.Initialize
Dim MainApp as string
settings.TryGetValue("MainApplication", MainApp)
End Sub
End Class
IIS can record all original URL in Log file before URL rewrite. IIS 可以在 URL 重写之前将所有原始 URL 记录在日志文件中。
The record of this is URI in URL, including all parameters.这个记录是URL中的URI,包括所有参数。
Or you can install Advanced Logging on IIS, it also can log original URL and rewritten URL.或者您可以在 IIS 上安装Advanced Logging ,它也可以记录原始 URL 并重写 URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.