Tuesday, March 27, 2007
Taking Advantage of SharePoint Session State Management
Sunday, March 18, 2007
Be cautious of web.config settings during deployments
- Infra team has to configure ISA and DNS pointing properly so that Training server can write event logs to SIT server. If training server can't find SIT server to write log, it waits until timeout occurs.
- SIT server shutdown will cause slow down in Training server.
- VPC version is slow because it was seperated from the LAN and has no access to SIT server.
The moral of the story So why does this happen in the first place? Often we copy web.config for deployment instead of making manual changes to the target environment's web.config files. Copying the settings from SIT server to Training server without making all the necessary changes is the root of this issue.
Therefore, one should go through the whole web.config settings throughly to ensure that the settings are meant for the target deployment environment.
Ajax Bandwidth Overhead
- Ensure debug mode is set to off in the web.config. For my case, the reduction of the *.axd files went from over 300+kb to 128kb. That's 60% size reduction.
- Making use of IIS compression. Although I suspect this wouldn't help much.
Therefore, one should consider this size factor when implementing Ajax into their web application. Some similar functionalities still can be achieved without using Ajax.
Saturday, March 17, 2007
Building Ajax-enabled custom web application on top of SharePoint
Ajax seems to be the in-thing for any web application nowadays. It is easy to implement into to existing ASP.NET application and bring huge improvement in the total user experience of a web application.
However, building an Ajax-enabled custom web application on top of SharePoint requires some tweaking before you get the wow effect of Ajax.
- If the Ajax-enabled custom application uses the SharePoint master pages, such as default.master master page, remove this SharePoint tag from it: <wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false"></wssuc:Welcome>. This affects Ajax postbacks. Removing it will partially fix the problem, e.g. one Ajax postback can be made, but subsequently no postbacks.
- Open LAYOUTS\1033\init.js file and look for javascript function _spFormOnSubmitWrapper. Under “if (_spFormOnSubmitCalled)” code block, remove/comment the “return false;” code. Not sure what is the effect of removing this bit though thus do it on your own risk!
Alternatively, the javascript function _spFormOnSubmitWrapper can be overwritten only on the pages that uses Ajax. This can be done by puting the modified version of the js function to a seperate .js file and reference it right after the line where reference to init.js were made.
Thanx to the post from Vincent Rothwell and comment by Phillip Lanier.
Turn on SharePoint error messages
Building application on top of SharePoint would be easier if exceptions thrown from the custom application are shown on the SharePoint error page. By default, SharePoint only shows the generic error message, "Unknown error occured". It does not show the cause of the error and it is difficult to debug the custom application.
Fortunately, found a posting from Shane Perran and Andrew Connell that shows how to give more sense to the errors thrown by modifying the default SharePoint web.config file:
- Turn the call stack on by searching for the SafeMode element
and set CallStack="true". - Turn off the SharePoint error pages by turning off custom error pages: search for customErrors tag and set mode="Off".
- And also, search compilation tag and
set debug="true".