Kentico sitemap not rendering with XML extension - kentico

I've gone through the documentation, set a page with the correct webpart, checked the web.config, and my sitemap only renders out the XML with .aspx.
here's my web.config snippet. I did make any changes here.
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
<remove name="XHtmlModule" />
<remove name="CMSApplicationModule" />
<add name="XHtmlModule" type="CMS.OutputFilter.OutputFilterModule, CMS.OutputFilter" />
<add name="CMSApplicationModule" preCondition="managedHandler" type="CMS.Base.ApplicationModule, CMS.Base" />
</modules>
I even tried an alias on the portal page.

In your settings you can set this. Go to Settings>URLs and SEO>Search engine optimization (SEO) and the first 2 boxes are what you want to set. The first box (Google sitemap URL) is the actual URL you'll navigate to. The second box (Google sitemap path) is where in the content tree the Google sitemap URL will get the content from.
So to say it a different way, the path is the holder of the actual sitemap content. While the URL is where you will actually navigate to to get the sitemap.
For instance if you have sitemap.xml in the Google sitemap path and your actual sitemap is located in the content tree at /special-pages/google-site-map you'd never navigate to the /special-pages/google-site-map page, only the /sitemap.xml page and that is what you'd submit to the search engines as well.

Related

Applying different Content Security Policies to different directories with NWebSec

I've got an ASP.NET MVC website with a heavily customised Umbraco 6 backend as the site's CMS.
I've been upgrading the content security policy (CSP) headers all across the site, which I am doing by use of NWebsec, and the website now happily uses CSP 3 strict-dynamic and there are nonces on every script tag, and everything works fine.
Unfortunately, I haven't been able to apply the same changes to the Umbraco admin area, so most of that does not work at all.
So what I want to do is apply the strict CSP 3 policy to the public-accessible parts of the website, and apply a relaxed CSP policy to the locked-down admin area.
The Umbraco admin area sits under a subdirectory /umbraco/ so I thought the best way to implement this would be to use two different location elements in the site's Web.config file.
So my Web.config now looks something like:
<!-- Specific CSP for Umbraco -->
<location path="~/umbraco">
<nwebsec>
...
<content-Security-Policy enabled="true">
...
<script-src self="true" unsafeInline="true" unsafeEval="true">
<add source="data:" />
</script-src>
...
</content-Security-Policy>
</nwebsec>
</location>
<!-- default CSP for everything else -->
<location path=".">
<nwebsec>
...
<content-Security-Policy enabled="true">
...
<script-src self="true" unsafeInline="true" unsafeEval="false" strictDynamic="true">
</script-src>
...
</content-Security-Policy>
</nwebsec>
</location>
But this applies the default config to the whole site.
I'm not sure whether I've got the config wrong, or maybe NWebSec doesn't support what I'm trying to do, or there's some specific issue with redirects or something else.
Fixed by creating a separate Web.config in the /umbraco subdirectory.
Main Web.config:
<location path="." allowOverride="true">
<nwebsec>
...
<content-Security-Policy enabled="true">
...
<script-src self="false" unsafeInline="true" unsafeEval="false" strictDynamic="true">
<add source="www.example.com" />
</script-src>
...
</content-Security-Policy>
</nwebsec>
</location>
Web.config in the /umbraco subdirectory:
<location path="." allowOverride="true">
<nwebsec>
...
<content-Security-Policy enabled="true">
...
<script-src self="true" unsafeInline="true" unsafeEval="true" strictDynamic="false">
<clear/>
<add source="www.other-example.com" />
</script-src>
...
</content-Security-Policy>
</nwebsec>
</location>
The config in the subdirectory overrides the main Web.config - so strictDynamic="false" switches off use of those CSP3 nonces, and the clear element removes all pre-existing elements in the collection so a new set of domains can be used.

coldfusion 5 and iis 6 custom 404 page no displaying

strong textI need to display a custom 404 page to visitors when they attempt to visit an old article and redirect them to the new one. I have the following in the web.config for the site
<system.web>
<customErrors defaultRedirect="/custom404error.cfm" mode="On">
</customErrors>
</system.web>
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/custom404error.cfm" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
When I run locally, Everything works great, however, I have ColdFusion 2016, and this project was written in ColdFusion 5. When I test on the proper servers, I hit a weird error, When the URL is something like www.domain.com/fakearticle.aspx my custom page pops up, however when the URL is www.domain.com/fakearticle.cfm or www.domain.com/fakearticle.htm, I get two different 404 error pages. My question is: Why am I getting 3 different error pages, and what can I do to my config file to fix this.
UPDATE Ive fixed it. I had some mixups between servers I was testing on. Deploying all my changes to the wrong server. It works as expected

Even though MIME-Type is set in IIS, cannot disply SVG file

IIS MimeTypes
I have an image tag with an svg file:
<img src="/uploadedImages/temp/Example.svg?n=9368" alt="testsvg" title="testsvg" align="middle">
which won't display in any browser. I can see in Developer Tools that the Content-Type is coming through as application/octet-stream. However, in IIS 7.5, I DO have the MIME-Type set as image/svg+xml (see attached screenshot in link "IIS MimeTypes" above). I also tried setting it in the web.config as follows:
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
but that also did not help. What am I missing? How do I get the correct Mime-type to load so that the image can show in the browser?
(By the way, in IE, if I browse to the file's location, the image DOES show. But not in Chrome and Firefox, they merely want to download the file instead of display it.)

Using img tag in View to display static picture

I'm moving from ASP.NET to MVC and having trouble displaying a simple image. I have a Controller:
Public Class LinkedImageController
Inherits Controller
' GET: LinkedImage
Function Index() As ActionResult
Return View()
End Function
End Class
and a View:
<img src="~/Views/LinkedImage/grey_336x280.gif" alt="Views-LinkedImage" /><!-- Doesn't work -->
<img src="~/Content/LinkedImage/grey_336x280.gif" alt="Content-LinkedImage"/><!-- Works -->
I have copies of the image in the Views/LinkedImage folder and the Content/LinkedImage folder and both are set to copy to the output folder.
As you can see from the comments in the View only the <img... tag that links to the file under the Content folder displays the image correctly.
While this is only a single image where I'm trying to get to is a design for displaying existing html questionnaires within an MVC framework so I have to work out where the various static files can be stored.
I'm new to MVC so I'm assuming that the image in the View folder cannot be displayed because the routing affects it somehow. Is this correct? If not, why does only one image display?
This line in the Web.config of your Views folder blocks direct access to files therein:
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
Best policy is to put your static content in ~/Content (or another folder you create in the application root directory, if you wish) - you don't want to risk giving a malicious user access to the code in your views.

404 page in Umbraco?

I installed Umbraco 4.5 and it is running fine. one thing i cant get to work though, is the 404. When it hit a page that does not excist it shows the default IIS7 404 page, and not the built-in umbraco 404 page.
So i am asuming it is a setting in the iis i have to change - but which?
Copy from http://our.umbraco.org/forum/using/ui-questions/8244-IIS7--404:
Basically, you need to add
<location path="Site Description">
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</location>
to your applicationHost.config file where "Site Description" is the name of your site in IIS7.
The applicationHost.config file is located in: system32\inetsrv\config
Edit:
As stated in the comments if this answer, you should add this section in your web.config instead which is way better, you should always avoid altering config files outside your own application that may affect other applications.
in config/umbraco.settings you can set the umbraco page to load for custom 404
<errors>
<!-- the id of the page that should be shown if the page is not found -->
<!-- <errorPage culture="default">1</errorPage>-->
<!-- <errorPage culture="en-US">200</errorPage>-->
<error404>1296`</error404>`
</errors>
The page error page ID goes between the <error404> & </error404> tags.

Resources