0

Extendng on my question at Is it possible to write a regular expression that catches a match that others have missed in IIS? I would like to know if I can have the rewrite rules write to a file. For example if the file test.aspx is not found and rather than redirecting the user, it gets logged into a file.

PeanutsMonkey
  • 1,832
  • 8
  • 26
  • 27

1 Answers1

1

IIS URl Rewrite can load custom providers so it's possible to do this using your own provider. For more information see:

Developing a Custom Rewrite Provider for URL Rewrite Module

Using Custom Rewrite Providers with URL Rewrite Module

Although it might be easier to trawl the IIS logs for 404 errors or have a customer 404 page to do this for you.

Kev
  • 7,777
  • 17
  • 78
  • 108
  • Thanks Kev. So there is no way to do it without the Providers? The reason being is that we are on a shared hosting environment and I highly doubt they will install the providers for us. – PeanutsMonkey Jul 12 '11 at 23:38
  • @peanuts - there's no built in mechanism to write to file "out of the box". However you shouldn't need your hoster to install the providers. Just drop them in your /bin folder and reference them in the `web.config` file as described in the articles. – Kev Jul 12 '11 at 23:40
  • Which files do I need to include in the /bin folder? – PeanutsMonkey Jul 13 '11 at 01:19
  • You have to write the provider yourself then deploy the compiled binaries into the /bin folder of your website. – Kev Jul 13 '11 at 01:26
  • Ah, according to the articles I could do them via IIS hence my assumption I could copy across the Provider assemblies into the bin folder and reference them from there. Unfortunately I am not a .NET developer. Is there any other way? – PeanutsMonkey Jul 13 '11 at 01:37
  • Unfortunately you need to roll your sleeves up and start cutting code. Not helpful I know, but have a Google around and see if someone else has written a provider. – Kev Jul 13 '11 at 01:41