iis host markdown files - iis

I've gone the route of adding the MIME type to IIS so that the files can be displayed by the browser and used a browser plugin to render the content, but this isn't really what we want.
Is there a way to serve markdown files as HTML from just an IIS site?
Is there an IIS handler that could accomplish this?

If you have IIS 7 or above, you could use a custom handler.
MSDN Blog article
You would just need to rename the extension to .markdown and it takes care of the rest.

Related

Site wide HTTP Header for Tags

I have just inherited a massive old HTML site that I want to track on Google analytics. It's nearly a 1000 pages of good old '90s html.
I've been running a web server for many years but am not a coder in any particular language although I do edit my PHP config files and my HTML files, install and configure modules in Mediawiki, phpBB and Drupal. I am currently on Svr2016, IIS10. For this HTML site, how would I include the Google tag (or any other tracking tag) in the header on every page served from my IIS console?
I need a pretty cut and paste or point and click solution.
Assuming you’re using IIS and have SSI enabled (SSI= server side include).
I would create an include file (server side include - could be .shtml) and paste the google analytics or tracking.
Then, I would find a file such as footer that’s used by all the other files and include it.
Or maybe put it other common files like navigation that’s used site-wide.
See sample use/issues.
https://serverfault.com/questions/244352/why-wont-ssi-work-in-iis

Orchard CMS - menu link to network-shared file

I have an Orchard 1.6 site hosted on Windows Server 2012, IIS 8.5, .NET 4.0.
I need to add a link to a network-hosted file into my Orchard menus, where the network share is accessible from my web server - the destination file itself resides on a different server. I put in file://path/to/network/file in the Custom Link menu URL, but the base URL of the site always gets prepended to the link.
E.g., if my base URL is http://example.com, the link becomes http://example.com/file://path/to/network/file, and then .NET does not like the second : in the path - on top of it being the incorrect link. No combination of forward-slashes, backslashes, or other symbols prevents the prepended base URL.
To add another wrinkle to this, the same URL scheme works fine with a slightly different setup: Orchard 1.6, Windows Server 2008, IIS 7.0, .NET 4.0; web server and destination network URL are on the same server.
Is there a way to force Orchard to use the URL as given, without changing it at all? Alternatively, where is the code that constructs the final link?
Using a 'HTML menu item' instead of 'Custom link' to insert raw HTML as a link does work, but that seems like a pretty kludgy workaround; I have to do this for a few dozen links, and I won't necessarily be the one to change them later on.
I've looked into Orchard settings and IIS settings; neither has anything about rewriting links. Changing the base URL on Orchard to match the expected destination server doesn't work (and wouldn't be acceptable long-term). I've also tried hosting a temporary local file (c:\temp\test.txt) but I can't even get that to produce the correct file:// destination on the new setup.
Upgrading to the latest Orchard (1.8.x) is not a feasible solution (if that even ends up being a possible solution).
Edit:
I should clarify that both sites are on an intranet; I'm aware of the security implications associated with file:// links, and the problems with getting various browsers to load them properly, but I want to get the link generation working first.
Edit: problem source
I figured out why link handling was inconsistent between my own sites - I had written a small chunk of Javascript in the first site to strip the application's base URL for any file:// links it encountered. I forgot that it was there and hardcoded to remove only a certain base URL, so when I moved the site to a different hostname, it broke.
So, no inconsistency in Orchard, just my own faulty memory.
Orchard deliberately limits menu links to mailto, tel, http, and https protocols, and excludes all others, such as file and ftp (see navigationmanager.cs). If you want to use other protocols, you will have to use another type of menu item, but please keep in mind that the file protocol is unsafe and is not supported by all browsers, for security reasons (see for example http://kb.mozillazine.org/Links_to_local_pages_do_not_work). Even Internet Explorer has stopped supporting it in the Internet zone since IE6 SP1: http://msdn.microsoft.com/en-us/library/aa767731(v=vs.85).aspx

favicon.ico not supported under Windows IIS

We have a problem under Microsoft IIS. People are not able to request the favicon through the browser. We checked all the coding of the website we are hosting on it and it is all fine. Problem is that the icon file seems to be blocked in general for the outside world:
Icon location: http://www.raakbeleving.nl/favicon.ico (gives 404)
Anybody any clue what could make this happen?
Our hosting provider cannot seem to solve the problem.
Thanks in advance.
See this page for a way to set up the content type in IIS 7.
Here there are a number of additional hints for it..
MS IIS Manager version 1809 includes a MIME type of .ico
**To Clarify the Problem: **
I have my favicon.ico in the root directory of my application which has an alias name of the website. I have run the same html through a number of servers. Each one looks for the favicon.ico, finds it, and uses it.
When you access a website without a favicon.ico, the icon on the browser tab for that site will have a browser default icon. The favicon.ico, when it exists, will replace that tabl icon with a custom one. I have found a lot of sites that discuss how MS IIS does not support favicon.ico.

.htaccess - is only for PHP?

I am working on one website which is developed in .net. I have uploaded .htaccess files but its nt working.
Is there any new idea for that? I want that my site will be crawled with www.
Thanks
.htaccess is not just for PHP.
It's a configuration file that's read by the Apache HTTP server. So if your application is not running on that server, then that file will not have any effect.
.htaccess and PHP are orthogonal. One is a configuration file for Apache; the other is a scripting language. More than likely, you're using Microsoft's IIS server, not Apache.
The .htaccess file is a configuration file for the Apache web server, and is not dependant on PHP. It typically contains settings relating to web site user permissions, friendly URL definitions, etc.
It can, however contain configuration settings for PHP, if you have settings which are in the server's PHP.ini file that you want to override for this specific web directory.
There are many reasons why a .htaccess file may not work -- it can be broken by some very subtle things, and a faulty .htaccess file will normally cause the whole site to stop working completely, regardless of what the error is.
In this case, the browser will usually simply show an error 500, without much useful information to help you debug it. But there will be more helpful debugging data in the server error log.
If you still struggle with it, you should post your .htaccess file here so we can help you debug it.
However, as #Tomalk says, if you're developing a .NET site then you're probably not using an Apache web server; you're probably using an IIS server. In that case, there are entirely different ways of setting the configuration for the server, and it won't know what to do with .htaccess file.

url rewrite in IIS

This question is related to another question which I asked yesterday!
List all links in web site
I think renaming all the .html files to .asp and changing the links is not good for SEP purposes. Some one told me that isapi plug-in can be used to redirect(301) all .html files to .asp files.
Can any one explain this for me? Searching did not help me much.
Thanks
We've been using the Ionic rewriter. It seems to work very well. Your application doesn't need any knowledge of the rewriter. You just configure it in IIS, and it redirects your links. It's also free/donationware.
IIS 7 has this feature built in.
You can use http://urlrewriter.net/ to do what you need. You'll need to set it up so that ASP.NET processes .html extensions. Then you can redirect (301) .html to .aspx very easily with this line in your web.config (in the urlrewriter section):
<redirect url="^(.+)\.html(.+)$" to="$1.aspx$2" permanent='true' />
Another option is not to rename the files at all. You could setup an application mapping for HTML files which will pass them through the asp processor. This will give you dynamic content, etc without any SEO side effects.
As ever, there is a downside. Passing an HTML file which is intended to be static through the asp processor is less efficient than just serving it up..

Resources