- Declare physical folder with same name with sharepoint virtual folders.
- Missing deploying physical files features, delegate controls, user controls, etc.
- Didn't give a physical files suitable permissions.
- Missing deploying custom templates.
- Didn't publish content files masterpages, layouts, pages, stylesheets.
Note: To discover this problem:
a. Change Master page from sitesettings to standard masterpage
b. If same error already exists republish layout.[checkout, checkin, publish layout]
c. If same error already exists validate existing physical controls, refrence dlls.
d. If error doesn't exists when you changed master page use your masterpage do same b,c with master page.
- Didn't deploy dependence files or sdks (refrence files of your dlls)
Tuesday, July 29, 2008
SharePoint 2007 File Not Found Problem
How to create your own custom 404 error page and handle redirect in SharePoint 2007 (MOSS)?
People alway ask how to use their own 404 file not found error page vs. the generic one from IE in MOSS environment. The following example catches the 404 error and sends users to a redirect page.
Here's the steps:
- In your MOSS server, make a copy of
%systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033\sps404.html
and call it my404.html - Create a Virtual Directory in IIS under your MOSS root web application. For example /errors
- Create your own redirect aspx page, for example /errors/my404redirect.aspx and code your redirect logic in there. This is a normal asp.net page.
- In my404.html, make the following change:
STSNavigate("/errors/my404redirect.aspx?oldUrl=" + requestedUrl); - Create a Console Application and insert the following code and run it in MOSS server
System.Uri webApplicationUri = new Uri(http://MyMOSSServer/);
SPWebApplication webApplication = SPWebApplication.Lookup(webApplicationUri);
webApplication.FileNotFoundPage = "my404.html"; //*note
webApplication.Update();
*Note: By default this is set to null. FileNotFoundPage needs to point to a html file that lives in %systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033. The file needs to be html only.
6. Now when you browse to a page that doesn't exist, you should expect to be brought to the redirected page.
*Another note:
In IE there's a "Show friendly HTTP error messages" setting which is ON by default in Internet Options->Advanced. With this setting on, sometimes your custom error page is not displayed. In order to override this setting, both my404.html and /errors/my404redirect.aspx from the above steps need to be larger than 512 bytes in size. Refer to the following KB about this setting: http://support.microsoft.com/kb/218155
* This seems to be working within a site collection context only, i.e. http://MyMOSSServer/sites/siteA if sites is a wildcard inclusion managed path and siteA doesn't exist in MOSS then this URL will NOT trigger the custom 404 error page set to SPWebApplication.FileNotFoundPage property.
Also look at SharePoint Smart 404 Feature in codeplex
http://www.codeplex.com/sharepointsmart404
It will give you advanced features
Tuesday, July 15, 2008
How to remove a bad webpart from a page?
Resolution:
Append ?Contents=1 to the webpart page's URL to display the Webpart Maintenance Page. On that page you can delete the malefactor.
Example: http://moss/default.aspx?contents=1
Monday, July 14, 2008
SSL on selective pages in MOSS
One possible solution is to untick the Require secure channel (SSL) option in IIS, and manually forcing a SSL using HTTP Module.
public class HttpModule:IHttpModule
{
public void Dispose()
{
//dispose function required to declare for HttpModule class
}
public void Init(System.Web.HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e)
{
RedirectSSL(System.Web.HttpContext.Current.Request.Url.PathAndQuery);
}
public void RedirectSSL(string pageURL)
{
//get the collection of the pages requiring SSL and not requiring SSL
//check for the current page exists in the group of pages requiring SSL
//if page is found in ssl group then redirect using https:// otherwise redirect with http://
bool found = false;
string sslPages = System.Configuration.ConfigurationSettings.AppSettings["SSLPages"];
char[] separator;
separator = new char[] { ',' };
string[] pages;
pages= sslPages.Split(separator);
for (int i = 0; i < pages.Length; i++)
{
if (pageURL.Contains(pages[i]))
{
found = true;
break;
}
}
if (found)
{
if (System.Web.HttpContext.Current.Request.Url.Scheme.ToString() == "http")
{
string sURL = System.Web.HttpContext.Current.Request.Url.ToString();
sURL = sURL.Replace("http://", "https://");
System.Web.HttpContext.Current.Response.Redirect(sURL);
}
}
else
{
if (System.Web.HttpContext.Current.Request.Url.Scheme.ToString() == "https")
{
string sURL = System.Web.HttpContext.Current.Request.Url.ToString();
sURL = sURL.Replace("https://", "http://");
System.Web.HttpContext.Current.Response.Redirect(sURL);
}
}
}
}