Sending URL to ISAPI module in IIS - iis

So I have an ISAPI module running my website. I would like to get the URL to be forwarded to my ISAPI module so that it can parse it and display things accordingly. For example, if I navigate to www.mydomain.com, I wish for my app to run. This does occur. However, I would like to navigate to www.mydomain.com/page1 and for my module to receive the "/page1" portion of the URL, which it does not. Rather, ISAPI complains because it cannot find the file "C:\where\I\have\my\app\deployed\to\page1".
I currently have my ISAPI module configured to run matching "/". If I configure it to run matching "*", it does not complain about not being able to find the file "page1" but instead treats anything I put into the URL as matching the module's request path and instead passes no URL information to the module.
I am uncertain what logs or settings would be useful to troubleshoot this issue.

ISAPI Filters are introduced in IIS 6, and not recommended any more since IIS 7. However, there might exists legacy code which needs to be maintained. So here is the guide to develop, troubleshoot and debug ISAPI Filters. But there is not a lot of documentation for this module to help.

Related

Localhost webserver denying PUT request

I have configured a webserver on localhost with https using Microsoft IIS Administration. I am able to browse directory with files with browsers and Visual Studio using localhost prefixed with https, such as https://localhost/trial etc.
I wish to upload a file to the said directory, ie., trial, using Libcurl to test some features. Unfortunately I'm unable to do so.
Using the same Libcurl example as given on
Libcurl File Upload
-modified for https, the console window tells me that the following has occurred, upon running the code :
IIS 10.0 Detailed Error - 405.0 - Method Not Allowed
HTTP Error 405.0 - Method Not Allowed The page you are
looking for cannot be displayed because an invalid method (HTTP verb)
is being used.
I checked the IIS Administrator and saw that all authorizations are allowed. I suppose the fact that it is flagging a HTTP verb issue rather than HTTPS as I'd enabled and used as URL in code isn't a big thing?
Libcurl uses PUT for uploading files, so should be an allowed verb.
I am quite new to this, so I'm not certain I did something incorrect with the setting up of the webserver, or whether there are security issues or permission issues which are causing a problem here.
As far as I know, there is impossible to use http put or post a file to a IIS web application's folder without writing server-side code. Otherwise, configure an FTP site on your IIS installation. Then you could use ftp command to upload the file.
If you really need using HTTP put or post to upload the file, you could consider using WebDav.
More details about what is webdev and how to use it, you could refer to below article.
https://learn.microsoft.com/en-us/iis/install/installing-publishing-technologies/installing-and-configuring-webdav-on-iis
https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-7/what39s-new-for-webdav-and-iis-7
Try hostname instead of localhost
Add a trailing slash (/) for the directory.

Add custom http response headers for files matching conditions

I need to add a custom http header to every http response from my IIS 8.5, but only for specific file types (css, js and html).
I've tried this solution
Add custom header based on file type, but it seems outdated, and I'm getting errors for bad web.config file.
How it can be done on IIS 8.5?Any help will be appreciated.
Solution on this link still working Add custom header based on file type for your problem.
You weren't able to use it because you need to install URL Rewrite module for IIS.
Please go to https://www.iis.net/downloads/microsoft/url-rewrite , download, install it and then restart IIS. After this steps error about bad web.config file should gone

Httpd's ScriptMap for extensionless URLs

There is a way to configure the Windows CE HTTPD server, so that it will load some defined ISAPI Extension (e.g., asp.dll) for a defined file extension (e.g., ".asp").
What is the easiest way to make it load some ISAPI Extension for extensionless file names in URLs?
At the end I have not found another way to accomplish my goal, but to create a special ISAPI filter just for this. This is a simple ISAPI filter, that handles the SF_NOTIFY_URL_MAP server event and changes the pszPhysicalPath variable according to extension mapping settings. To make it a little more general, I made it to support not only mapping from extension-less paths, but to map from any to any extension. The mappings are set in Windows Registry.
How it works, basically:
A request gets to the HTTPD server, say to URL /vroot/file
The server maps /vroot/file to some physical path, say \disc\vroot\file
The server calls the filter with the physical path, and the filter maps it to, say, \disc\vroot\file.asp, according to it's settings.
The server then handles the file correctly with the asp.dll, according to the ScriptMap registry settings.
In case someone needs it, I've published the source code on GitHub.
Did you try to use "." as file estension? Never tried myself, it's just an idea.
Or you may use an ISAPI extension and re-define a whole virtual root, but this applies to all requests under that root, not just file names with no extension.

getting 404 error accessing CFM page

I am trying to access a coldfusion file on Server.
The file with xyz.htm extension works fine where as when I convert the same html into coldfusion file, like xyz.cfm , it throws following error:
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
May I know what could be the reason?
Assuming CF8 on IIS6?
Could be that you've not correctly run the wsconfig.exe tool which will tie in CF to IIS etc.
Need to know which version of CF, which webserver/OS & versions to help further.
Basically, the webserver needs to know how to parse .cfm requests; without running the webserver connector tool, it won't know which files to use to actually deal with the .cfm files.

Can IIS 6 serve requests for pages with no extensions?

Is there any way in IIS to map requests to a particular URL with no extension to a given application.
For example, in trying to port something from a Java servlet, you might have a URL like this...
http://[server]/MyApp/HomePage?some=parameter
Ideally I'd like to be able to map everything under MyApp to a particular application, but failing that, any suggestions about how to achieve the same effect would be really helpful.
You can set the IIS6 to handle all requests, but the key to handle files without extensions is to tell the IIS not to look for the file.
http://weblogs.asp.net/scottgu/archive/2007/03/04/tip-trick-integrating-asp-net-security-with-classic-asp-and-non-asp-net-urls.aspx
You can also create an ISAPI filter that re-writes urls. The user enters a url with no extension, but the filter will interpret the request so that it does. Note that in IIS it's real easy to screw this up, so you might want to find a pre-written one. I haven't used any myself so I can't recommend a specific product that's any different than what you'd find via google, especially as I don't know your specific use case. But at least now you know what to search for.
You can also rewrite your urls using ASP.Net:
http://msdn.microsoft.com/en-us/library/ms972974.aspx

Resources