|
Member
|
ankit_p_mistry_123-yahoo.co
-
12/31/2012 2:58:23 AM
Problem in 404 redirection on specific custom error page.
Hi,
I want to redirect to 'page not found' custom page when we browse any url from address bar which is not included in our website. I already did setting in CMS SiteManage >> Setting >> Content >> Page Not found. But when i add some invalid url e.g. test.com/xyz.pdf then it will give an error like "Object reference not set to an instance of an object."
How can i achieve this functionaliy?
Thanks in advance.
|
|
|
Kentico Customer Success
|
kentico_martind2
-
12/31/2012 3:13:34 AM
RE:Problem in 404 redirection on specific custom error page.
Hi, Could you please confirm that you have followed our Developers Guide - Configuring custom error pages where you can find that you need to add the key also to your web.config file. Which version of .NET are you running? Best regards, Martin Danko
|
|
|
Member
|
ankit_p_mistry_123-yahoo.co
-
12/31/2012 6:38:43 AM
RE:Problem in 404 redirection on specific custom error page.
Hello Martin,
Yes i have followed kentico developer guide and configured according to it but when i browse my site with any document url like 'www.testsite.com/xyz.doc', it gives an error like 'Object reference not set to an instance of an object.'.
When i went through below url i got above mentioned error, http://fonehouse.co.uk/xyz.doc
http://fonehouse.co.uk/xyz.pdf
But when i went through our another site using below url, it is working fine. http://217.160.92.42/xyz.doc
Both sites have same configuration.
|
|
|
Member
|
ankit_p_mistry_123-yahoo.co
-
1/1/2013 1:01:50 AM
RE:Problem in 404 redirection on specific custom error page.
Can you please reply for my previous post?
We are using .net 4.0 version.
|
|
|
Kentico Customer Success
|
kentico_martind2
-
1/2/2013 1:13:37 AM
RE:Problem in 404 redirection on specific custom error page.
Hi,
Could you please copy the full error message or maybe attach a screenshot? Thanks!
Best regards, Martin Danko
|
|
|
Member
|
ankit_p_mistry_123-yahoo.co
-
1/2/2013 7:06:56 AM
RE:Problem in 404 redirection on specific custom error page.
Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
<configuration> <system.web> <compilation debug="true"/> </system.web> </configuration>
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] CMS.PortalEngine.PageInfoProvider.GetDataForPageInfoForUrl(String url, String cultureCode, String defaultAliasPath, Boolean combineWithDefaultCulture, Boolean isDocumentPage, PageInfoSource& source, String& wildcardQueryString, String& documentAliasUrlPath) +4162 CMS.PortalEngine.PageInfoProvider.GetPageInfoForUrl(String url, String cultureCode, String defaultAliasPath, Boolean combineWithDefaultCulture, Boolean isDocumentPage, PageInfoSource& source, String& wildcardQueryString, String siteName, String& documentAliasUrlPath) +555 CMS.URLRewritingEngine.URLRewriter.RewriteUrl(String relativePath, ExcludedSystemEnum excludedEnum, SiteNameOnDemand siteName, ViewModeOnDemand viewMode) +6179 CMSAppBase.RewriteUrl(URLRewritingResultEnum status, String relativePath, ExcludedSystemEnum excludedEnum, ViewModeOnDemand viewMode, SiteNameOnDemand siteName) +44 CMSAppBase.CMSMapRequestHandler(Object sender, EventArgs e) +205 CMS.CMSHelper.CMSApplicationModule.app_MapRequestHandler(Object sender, EventArgs e) +27 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
|
|
|
Kentico Customer Success
|
kentico_martind2
-
1/2/2013 8:43:49 AM
RE:Problem in 404 redirection on specific custom error page.
Hi, Thanks for the details. Could you please check your URL settings - Configuration of custom URL extensions (.html or other). You can compare them on both of your sites and see the difference. Best regards, Martin Danko
|
|
|
Member
|
Ankit Mistry
-
1/18/2013 2:38:28 AM
RE:Problem in 404 redirection on specific custom error page.
Hello Matin, I have update following line in web.config and it is working fine: <httpErrors> <remove statusCode="405" subStatusCode="-1" /> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="/PageNotFound" responseMode="ExecuteURL" /> <error statusCode="405" prefixLanguageFilePath="" path="/FoneHouse/CMSPages/handler404.aspx" responseMode="ExecuteURL" /> </httpErrors> Thank You for our Help. Best Regards, Ankit
|
|
|
Kentico Customer Success
|
kentico_martind2
-
1/18/2013 4:22:50 AM
RE:Problem in 404 redirection on specific custom error page.
Hi Ankit,
Thanks for letting us know about your solution, well done! I think it may help also other users in the future.
Best regards, Martin Danko
|
|