0

I'm trying to handle “The resource cannot be found.” error 404 when there is a dot at the end of url in sharepoint 2010 site.

I found this link https://stackoverflow.com/questions/429963/the-resource-cannot-be-found-error-when-there-is-a-dot-at-the-end-of-the-ur , this link is talking about

<httpRuntime relaxedUrlToFileSystemMapping="true" /> which is supported only in .Net 4.0 but sharepoint 2010 is working with .Net 3.5 CLR 2.0 I tried also handling Application_PreSendRequestHeaders in global.asax but it didn't work , I tried also ' IIS URL Rewriting Module 2.0. ' but I don't know how to use it correctly is it an inbound rule or outbound rule ? .

any help please , Thanks .

1
+50

i presume from the reply that you want a custom 404 page? there are two methods. One is generic:

To configure SharePoint Foundation server or SharePoint Server 2010 to point to a custom 404 error Web page, follow these steps.

1.Log on to the computer that is running SharePoint Server 2010 by using an account that has administrative permissions.

2.In Windows Explorer, locate the following folder:

%systemdrive% \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\LangID

Notes

• In this path, %systemdrive% represents the actual drive name of the drive on which the operating system is installed.

• In this path, LangID represents the actual language ID of the language that you use. For example, 1033 is the language ID for U.S. English.

3.Create the custom HTML file:

a.On the computer that is running SharePoint Server 2010, copy the Sps404.html file to a temporary folder. b.Rename the Sps404.html file. For example, give the file the following name:

Custom404.html c.Modify the Custom404.html file to suit your needs for a custom 404 error message using an HTML editor.

4.Copy the Custom404.html file to the %systemdrive% \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\LangID folder.

5.Run the following PowerShell commands from the SharePoint 2010 Management Shell: $webapp =Get-SPWebApplication http://: $webapp.FileNotFoundPage = "Custom404.html" $webapp.update()

Verify that the property is set by running the following command:

(Get-SPWebApplication http://:).FileNotFoundPage

http://support.microsoft.com/kb/941329

if you want somthing that would handle a specific error, than that is different and will require some programming.

Add custom error handler at beginning of modules section in web.config (not manually)

the above method is what iv done (similar) to handle different types of errors and i attached it to a feature to add and remove customisation when i want :)

EDIT

due to a link it refers within the second version that he referes to as the solution I have taken the oppertunity to save the content, this from google cache.

An Expected Error Has Occurred 1 Reply There is not a single sole on this planet which has used SharePoint that has not seen the error message “An Unexpected Error has occurred”. Bold statement, and obviously I don’t have the research to back it up but you must admit its an error allot of folks see from time to time if you spend any time on a SharePoint site – hopefully that will change soon.

With SharePoint 2010 you can now set your own custom error pages. This has been a much asked for feature from allot of my customers and has the potential to offer a much better user experience. In fact, one which you may choose to vary depending on the role of the user. For example, you may want to provide a very generic error for anonymous users and a much more detailed error of the user happens to be the site collection owner or farm admin.

Its not only the error pages that got all the love here, in fact you can customize the Access Denied, Confirmation, Login, Request Access, Sign-out, and Web Deleted pages. The SPWebApplication.SPCustomPage enumerator is used to pass the page which you wish to override into a call to UpdateMappedPage() along with the path to the custom page. So once set, this page will be used anytime a request is made for the corresponding page. Since this method is part of the SPWebApplication you will note a custom pages are scoped to the web application.

What is really happening here is SharePoint’s Virtual Path Provider (VPP) does a check each time it’s asked to resolve a path to a file and if the current Web Application has a custom page configured it will be served rather than the original error page. This means URLs and code references to these pages will not need to be updated to paths to your custom files because the VPP handles the redirection.

If you choose to remove a custom page you make the same call into UpdateMappedpage passing NULL for the page path and the corresponding enum value for the page you wish to disconnect.

I would highly recommend anyone who deploys an Internet facing SharePoint site override at the very least the error page for at least three reasons:

1) Own your messaging to the anonymous user, don’t let SharePoint send messages to your users. What is the point of giving them an error they most likely cannot understand, don’t care too, and most likely could not take any corrective action to fix.

2) Currently there is a bug that will hopefully get fixed before SharePoint 2010 hits RTM which allows anyone to place an error message on the error page, for example on your SharePoint site append this string to your URL: _layouts/error.aspx?ErrorText=ErrorBaby!

3) There is an opportunity to offer a better user experience, the custom error page might collect additional information and send that along to those interested, you may choose to collect additional information from the user by asking for feedback, or you may offer additional details if the user is privileged enough, based on his or her role to understand what may be going on with the server.

Here is some example code to get you started – this is a custom feature receiver which you might use to hook a custom error page.

  [Guid("bf07336a-76d7-4324-8908-74e2771bba49")]
   public class CustomPageMappingsFeatureEventReceiver : SPFeatureReceiver
   {
       const string CustomErrorPage = "/_layouts/CustomPageMappings/Error.aspx";

       public override void FeatureActivated(SPFeatureReceiverProperties properties)
       {
           SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
           if (webApp != null)
           {
               if (!webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, CustomErrorPage))
               {
                   throw new ApplicationException("Cannot create the new error page mapping.");
               }
               webApp.Update(true);
           }
       }

       public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
       {
           SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
           if (webApp != null)
           {
               if (!webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, null))
               {
                   throw new ApplicationException("Cannot reset the default error page mapping.");
               }
               webApp.Update(true);
           }
       }
   }

http://webcache.googleusercontent.com/search?q=cache:BwmRJQ5_eUUJ:todd-carter.com/post/2010/04/07/an-expected-error-has-occurred/+&cd=1&hl=en&ct=clnk&gl=uk

6

According to Microsoft:

  • You cannot use the period character at the end of a site name, a subsite name, or a site group name.
  • You cannot use the period character at the end of a folder name.
  • You cannot use the period character at the end of a file name

http://support.microsoft.com/kb/905231/en-us

Are you looking for a way to by-pass this directive?

  • Thanks for your reply , I know that using . character is illegal , I want to handle this issue if user entered a wrong link , I want to redirect him to friendly page , not asp.net 404 error page – Mahmoud Farahat Aug 24 '13 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.