Sharepoint 2010 Redirect to Access Denied Page

Hi everyone ,

If your code need  to redirect access denied page in somewhere you can use SPUtility.HandleAccessDenied() function.

Here is an example:

SPUtility.HandleAccessDenied(new Exception(“You don’t have access rights to see this content”));

Happy tips.

Sharepoint 2007 Error in HtmlEditor.js Line:5740

Symptom:

A single user with Full Control permissions is having trouble using certain page-editing functions. And getting javascript error with HtmlEditor.js

Here is the error:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; .NET CLR 3.0.04506.648; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8; MS-RTC LM 8)
Timestamp: Mon, 24 May 2010 16:13:42 UTC

Message: Invalid argument.
Line: 5740
Char: 2
Code: 0
URI: http://www.[TheSiteURL].com/_layouts/1033/HtmlEditor.js

Solution:

Add your site to your local intranet zone in your browser.

IE -> Tools -> Internet Options -> Security -> Local Intranet -> Sites

Thats all.

 

Administrative service for this server is not enabled when deploy

Full error is:

The timer job for this operation has been created, but it will fail because the administrative service for this server is not enabled. If the timer job is scheduled to run at a later time, you can run the jobs all at once using stsadm.exe -o execadmsvcjobs. To avoid this problem in the future, enable the Windows SharePoint Services administrative service, or run your operation through the STSADM.exe command line utility.

Here is the solution :

Go to Start > Run and Type services.msc

Now in Services window select “SharePoint 2010 Administration”Right click and start

Thats it.

Sharepoint 2007 & 2010 Execution Timeout

Sometimes your code needs  time to execute and sharepoint throw an error about Timeout .  here is the solution:

Add this config line to your web.config.

<httpRuntime maxRequestLength=”51200″ executionTimeout=”1200″/>

MSDN say for executionTimeout : Optional Int32 attribute.Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.

This time-out applies only if the debug attribute in the compilation element is False. If the debug attribute is True, to help avoiding application shut-down while you are debugging, do not set this time-out to a large value.

The default is 110 seconds. If you set executionTimeout 1200 means 20 minutes.

Here’s the complete syntax for this tag:

<httpRuntime executionTimeout=”seconds”
maxRequestLength=”kbytes”
minFreeThreads=”numberOfThreads”
minLocalRequestFreeThreads=”numberOfThreads”
appRequestQueueLimit=”numberOfRequests”
useFullyQualifiedRedirectUrl=”true|false”  />

This time-out applies only if the debug attribute in the compilation element is False. when set to “debug=true” mode, the runtime will ignore the timeout setting.

Important note: If you are working with application pages in Layouts folder you should change web.config of this folder not your application folder.

If you want to use this attribute for one page your config should be like this

<location path=”MyPages/TestPage.aspx”>
<system.web>
<httpRuntime
executionTimeout=”1200″
maxRequestLength=”51200″ />
</system.web>
</location>

Happy tips..

Sharepoint 2010 Publishing Portal and missing Search Center template

Hi everybody, last day one of my friend called me and asked ” i provision a Publishing portal template but i couldn’t found Search Center Templates do you know where are they?” If you encounter with this situation Dont panic they are already there but  in sharepoint 2010 when provisioning Publishing Portal and Enterprise Wiki templates other templates administratively disabled by default .You can activate them  from Site Actions->Site Settings -> (Look and Feel) Page layouts and site templates

Happy tips & tricks