How can I activate kml file in Umbraco 7.2.8? - kml

I am developing a new site in Umbraco 7.2.8.
I need display google maps in the site, I have the kml file with all information and the js file to process the information, but when I load the file in front-end I have the error "GET http://myserver/Scripts/agencias.kml?=1443806128026 404 Not Found"
"NetworkError: 404 Not Found - http://myserver/Scripts/agencias.kml?=1443806128026"
How I can activate or display the kml file?
Thanks

You can add the .kml extension to web.config
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".kml" />
<mimeMap fileExtension=".kml" mimeType="application/vnd.google-earth.kml+xml" />
</staticContent>
</system.webServer>
</configuration>

Related

Redirecting to custom error pages in Azure Application service doesn't work

I'm trying to redirect in case of an http error to a error page hosted in an external url making use of the element <httpErrors> in my web.config file in server.
Currently I have the following configuration
<configuration>
<system.webServer>
<httpErrors errorMode="Custom" defaultResponseMode="Redirect">
<error statusCode="404" path="https://my-custom-error-page.com" />
</httpErrors>
...
and whatever I set as defaultResponseMode I cannot get the error page, and instead I'm still retrieving always the IIS error page.
someone knows what's missing?
IIS version 8.5
https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/
Redirecting to custom error pages in Azure Application service doesn't work
Make sure your web.config is deployed in the wwwroot directory
Iam able to redirect to CustomError page with the below setting in web.config when an error occurs
<httpErrors existingResponse="PassThrough" />
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/public/404.html" responseMode="ExecuteURL" />
</httpErrors>
Under <system.webServer> , Make sure you add
<httpErrors existingResponse="PassThrough" />
Check the path correctly
Under wwwroot folder created one folder named public and added the error.html page. Give the same path /public/404.html in web.config
Tried to access the page which does not exists, it redirected to the error page

IIS: set response code in web.config

I have a tiny website that serves as my maintenance placeholder page.
It has one html document that gets served as an error page for 404s and 403s which will, since there's nothing else there, be always served.
But really, I wish the response code was rather something like 503. How can I do that purely in web.config without resorting to ASP.NET?
Try this:
<configuration>
<system.webServer>
<httpErrors errorMode="DetailedLocalOnly" defaultResponseMode="File" >
<remove statusCode="500" />
<error statusCode="500"
prefixLanguageFilePath="C:\Contoso\Content\errors"
path="500.htm" />
</httpErrors>
</system.webServer>
</configuration>
See this link for more info:

using IIS to serve files without extension as plain text

I've tried using an answer from IIS: How to serve a file without extension?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".*" mimeType="text/plain" />
</staticContent>
</system.webServer>
</configuration>
Which is letting me target the file, but not access it
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension
configuration. If the page is a script, add a handler. If the file
should be downloaded, add a MIME map.
Try this
<staticContent>
<mimeMap fileExtension="." mimeType="text/html" />
</staticContent>

Setting MIME type of a file from web.config

I have a temporary directory at:
c:\inetpub\mysite\temp\
I build a text file dynamically and save it to that directory. Then I have the users browser download that file by putting it into an iframe. This works fine for files that the browser can't open (.doc, .zip) but because I'm using a .txt file the browser just opens it. e.g. It never goes through the normal download process where you can pick where you want to have it downloaded.
A little research and I found you can put a web.config in the same directory as the file to configure the HTTP headers and then do something like:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".txt" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
But when I do that I get Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.txt' So I'm guessing at a web.config at a parent level is already setting the MIME type for .txt.
Is there a way to set the MIME type for static content in a leaf directory (or for a specific directory) using a web.congig file?
I found it. You have to remove the other one before adding.
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".txt" />
<mimeMap fileExtension=".txt" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>

HTTP Error 404.7 - Not Found The request filtering module is configured to deny the file extension

I'm trying to configure the default webpage for an IIS 7.5 website.
Request filtering is turned on. However .aspx pages are allowed, I've set default.aspx to be the default page for the website.
If I browse to localhost/default.aspx I get a webpage as expected.
IF I browse to localhost/ I get
HTTP Error 404.7 - Not Found
The request filtering module is configured to deny the file extension.
Any ideas?
It looks like the request filtering is actually filtering for a blank file name. Therefore you have to add this to the request filtering block in the web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<fileExtensions allowUnlisted="true">
<remove fileExtension="." />
<add fileExtension="." allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
</configuration>
It's obvious now, but really I think its a massive gotcha.
More info: IIS 7 Not Serving Files - 404.7 Error
You can resolve by adding:
<requestFiltering>
<fileExtensions allowUnlisted="true">
<remove fileExtension="." />
<add fileExtension="." allowed="true" />
</fileExtensions>
</requestFiltering>
to your Web.Config file
You can resolve this by adding the file extension into the request filtering module of IIS.
Be sure to remove any PostBackURL="MyPage.aspx" from the button on the page. My guess is that when the postbackurl is included, IIS thinks its getting the page as a file. It rejects the .aspx file type by default. You can see this in the page error.
Bad: Creates a 404.7 (notice the PostBackURL)
<asp:FileUpload runat="server" ID="uplReplaceFile" ToolTip="Update this file" />
<asp:Button runat="server" PostBackUrl="MyPage.ascx" ID="bnHiddenFileUploadListener" OnClick="bnHiddenFileUploadListener_OnClick" />
Good: No error
<asp:FileUpload runat="server" ID="uplReplaceFile" ToolTip="Update this file" />
<asp:Button runat="server" ID="bnHiddenFileUploadListener" OnClick="bnHiddenFileUploadListener_OnClick" />

Resources