iis - Block empty user agent with URLScan -


i'm able block specific user agent, i'd block requests empty user agent using urlscan v3.1.

does know how this?

there isn't way configure using urlscan, can done custom isapi filter on iis server. here in c++:

dword winapi __stdcall httpfilterproc(http_filter_context *pfc, dword notificationtype, void *pvdata)  {      char buffer[256];     dword buffsize = sizeof(buffer);     http_filter_preproc_headers *p;     switch (notificationtype)  {       case sf_notify_preproc_headers :       p = (http_filter_preproc_headers *)pvdata;       bool bheader = p->getheader(pfc,"user-agent:",buffer,&buffsize);        cstring useragent(buffer);       if(useragent.getlength() == 0) { // reject blank user agents         p->setheader(pfc, "url", "/rejected-blank-user-agent");       }       return sf_status_req_handled_notification;      }     return sf_status_req_next_notification;  } 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -