TheDizzle
TheDizzle

Reputation: 1574

How do I add a custom .aspx page to sitecore?

I've recently created an aspx and aspx.cs page that needs to run alongside a sitecore website. Does anyone know how i can add these pages into the site? Our set up is very odd and would like to know recommendations before trying anything and risking breaking our setup.

Upvotes: 3

Views: 3036

Answers (4)

Ruud van Falier
Ruud van Falier

Reputation: 8877

You don't necessarily have to add your page to the IgnoreUrlPrefixes.
Before the ItemResolver is executed, the FileResolver is executed which checks if your request points directly to a file on disk.

You do need to configure the allowed URL extensions in the FilterUrlExtensions processor of the preprocessRequest pipeline, as such:

<preprocessRequest
    <processor type="Sitecore.Pipelines.HttpRequest.FilterUrlExtensions, Sitecore.Kernel">
      <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx</param>
      <param desc="Blocked extensions (comma separated)">*</param>
    </processor>
</preprocessRequest>

So that configuration will allow *.aspx, *.ashx and *.asmx to be requested directly (it's the default configuration in Sitecore 7.0).

If you're using Sitecore 6.6 or lower, the FilterUrlExtensions processor can be found in the httpRequestBegin pipeline.

Upvotes: 8

jammykam
jammykam

Reputation: 16990

Just add the pages to the projects as normal (as DustinDavis suggested) but you also need to modify IgnoreUrlPrefixes in web.config (or add a config patch file) and include the pages or folders as pipe delimited values that you want the Sitecore handlers to ignore.

You can configure the value attribute of the /configuration/sitecore/settings/setting element in web.config with name IgnoreUrlPrefixes to prevent Sitecore from processing specific requests, causing ASP.NET to process the request without Sitecore.

From Sitecore Presentation Component Reference

There is more information about the how and why in this blog post by Alex Ahyba

Upvotes: 5

Dustin Davis
Dustin Davis

Reputation: 14585

If you have sitecore open in Visual Studio, just add them in to the project. You can access the new page directly.

Upvotes: 0

Blair Scott
Blair Scott

Reputation: 1885

If you just drop the ASPX page in at the path you'd like it to reside, by default, Sitecore should let it be served as is by going to the corresponding URL.

Upvotes: 5

Related Questions