Skip to main content
Use this setup when your site is a classic ASP.NET site (System.Web, for example MVC 5 or Web Forms) and IIS serves it. The relay is the Waniwani.Relay.AspNet NuGet package. It is an IIS module, so you add it to web.config and do not change your code. You need .NET Framework 4.6.2 or later, and IIS in integrated mode. The relay records the agent visits, serves agent pages and blocks agents. You turn agent pages and blocking on and off in the dashboard, with no deploy.

Add the package

Run this command in the Package Manager Console of Visual Studio, in the web project:

Edit web.config

The setup screen gives you these lines with your region. Put your key in place of PASTE_THE_KEY:
web.config
Do not add preCondition="managedHandler" to the module. Without it, the module also runs for static files such as /llms.txt. For an organization in the EU region, the setup screen adds <add key="Waniwani:Region" value="eu" />.

Behind a CDN or a load balancer

When a CDN, a WAF or a load balancer is in front of IIS, IIS sees its address on each request, not the address of the visitor. The CDN puts the visitor address in a request header, for example X-Forwarded-For. Ask your CDN provider which header it uses and which addresses it connects from. Then set:
  • Waniwani:ClientIpHeader to the name of that header.
  • Waniwani:TrustedProxies to the addresses and CIDR ranges of the CDN and the load balancers, separated by commas.
The relay reads the header only when the request comes from a trusted address. Thus a visitor cannot send a false X-Forwarded-For. Without these two settings, detection by User-Agent still works, but detection by IP range does not. When IIS gets the requests directly, remove the two lines.

Network access

IIS must make outbound HTTPS calls to these hosts: When the relay cannot get to Waniwani, your site works as usual. The relay drops the events and does not serve agent pages.

Deploy and check

Deploy the site. In the setup screen, enter the address of one of your pages and click Check now.

Settings

Notes

  • A CDN can answer an agent from its cache. Then the request does not get to IIS, and the relay does not see it. Make sure that your CDN does not keep HTML pages for agents, or that it sends requests with Accept: text/markdown to IIS.
  • For paths with agent pages, the relay turns off the IIS kernel cache.
  • The package is open source. The README has all the settings, and ASP.NET Core.
  • To open this setup directly, use https://app.waniwani.ai/agent-traffic/websites/new?platform=aspnet.