Oct 14, 2010

Does the Current or Logged in SharePoint User belongs to a certain Distribution Group of the Active Directory

Use the following to determine if the Logged in SharePoint User belongs to a certain Distribution Group of the Active Directory :

Page.User.IsInRole("domain//groupname")

Since the SharePoint site runs on IIS. We can call Page.User.IsInRole("domain\groupname") to determine if the user is a member of the Active Directory group.

NOTE: For C#, use two backslashes instead of just one.


Understanding the difference between distibution List and Security Group is important.

In Microsoft Active Directory, what are security and distribution groups?

In Microsoft Active Directory, when you create a new group, you must select a group type.
The two group types, security and distribution, are described below:

Security: Security groups allow you to manage user and computer access to shared resources. You can also control who receives group policy settings. This simplifies administration by allowing you to set permissions once on multiple computers, then to change the membership of the group as your needs change. The change in group membership automatically takes effect everywhere. You can also use these groups as email distribution lists.
Distribution: Distribution groups are intended to be used solely as email distribution lists. These lists are for use with email applications such as Microsoft Exchange or Outlook. You can add and remove contacts from the list so that they will or will not receive email sent to the distribution group. You can't use distribution groups to assign permissions on any objects, and you can't use them to filter group policy settings.
Refrence: Active Directory

BTW, Admin of AD should create a Security Group not just the distribution list. :)

Sep 24, 2010

Infopath Form picking date time from the client machine instead from the SharePoint Server

When using date time in InfoPath Forms, make sure you are aware of the fact that InfoPath 2007 is picking up the date time from the machine on which it's running i.e. clientt machine.

If the usage of the Infopath Forms (i.e. application) is in a single time zone then this might work well until and unless the client machine has the incorrect value set for date time.

Your application at certain time instances won't work properly if you have validations like date time greater then or less then current time and is being accessed by client located in the different time zones around the world.

To mitigate this issue, you need to write code behind in the page load function of infopath form. The code will basically pick the server time and store it with infopath form so that validations can be performed seamlessely regardless of the timezone of the client machine.

Sep 14, 2010

DataView WebPart Sorting Across Pagination Issue



The Sorting in data view web part (when enabling the "basic list toolbar" checkbox in properties using SharePoint Designer) works for the rows which are currently displayed (i.e. displayed on the page)
No need to modify the XSLT.

Sorting will not work across pagination as this is to sort list which has huge amount of data and sorting the entire list might take long time.

Although, If you would like to sort the entire list, please use the toolbar for sorting option in data view properties.


 


Sep 3, 2010

SharePoint Maintenance Page

Three options for the SharePoint Maintenance page based on the available infrastructure:

1)      Using modified ISA custom error page and display custom messages.
          - For internal clients, the files are named Error_number.htm. \
          - For external clients, the files are named Error_numberR.htm (where R indicates reverse).

2)      Display custom message on IIS at Web Front End Server in the SharePoint Farm
         - Create a page "App_Offline.htm" in the Root Site

3)      Route the request from ISA to another Site hosting maintenance page.
         - Maintenace page site on same IIS

Reference: ISA

Jun 20, 2010

Port or Move DataView WebPart from one site or server to another site or server:

Dataview webparts can be developed in development environment and can be ported to a different environment as shown below:


• Edit the WebPart Page > WebPart > Export the Dataview Webpart and save it.


• Import the Data View Webpart on the intended site > webpart page

• The WebPart should display error not the page, i.e. page should render correctly.

• Open the WebPart page using SharePoint designer, go to DataFormWebPart and change the following as shown below:
  or you con modify the .webpart file itself.


Jun 5, 2010

Plan SharePoint Application for Optimum Performance

 Ten points to consider for performance out of many other.


  1. Distribute user data across multiple content databases
  2. Limit navigation depth
  3. Defragment database indexes
  4. Minimize page size, for internet facing sites or Lazy Loading
  5. Isolate search indexing
  6. Configure SQL parameters i.e. connection pool, indexes, so on
  7. Separate user and database traffic i.e. seprate networks
  8. Configure IIS compression
  9. Take advantage of caching
  10. Manage page customizations
Refrences:

Jun 4, 2010

SharePoint Farm Communication - can be performance bottleneck

This blog helps to ensure that the SharePoint Farm communication is not becoming the performance bottleneck for the application deployed onto the SharePoint farm.

SharePoint Application Communications:


Inter Server Communication

• Within the SP Server Farm.

Intra Server Communication

• Between SP WFE Server and External Server (system).

Client Server communication

• Client Browser/Machine and SP WFE Server

Database Load

• SP SQL Server database



Tools used to analyze the communications mentioned above:

Inter Server Communication

• WireShark Installed on WFE Server

Intra Server Communication

• WireShark Installed on WFE Server

Client Server communication

• Http Watch on Client Machine

Database Load

• SQL Profiler on the SP SQL DB




Identify the IP of all the Involved Servers

1) SP SQL Database server

2) WFE Server(s)

3) DNS

4) ISA

5) Application Servers

6) Client Machine

7) External Business application servers




Execution Pre requisites:

If applicable perform the following

1) Remove load balancing

2) Blank homepage for client machine browser

3) No one else other then the person performing network analysis i.e. any other user (application user or admin user is accessing the SP farm or the application by one or the other mean)

4) Make sure the external servers are up and running.



Execution Steps:

1) In the SP Farm restart the following services on all servers as applicable

• IIS

• SQL Server Service

2) Clean the client machine browser cache, close and open again.

3) Run the Wireshark on the WFE

4) Run browser with httpwatch on Client machine

5) Browse to site, stop and save the results of wireshark and httpwatch.





Analyze the WireShark and HttpWatch Results, following can be leveraged:

Protocols used between SP servers

o For database it’s TDS.

o Used by search and query services is SMB

o Obviously, also the http protocol.

Ports used in communication

o SQL Server 1433

o AD Authentication on TCP:445 or TCP:88 (Kerberos)

o LDAP:389 and LDAPS:636

o DNS on TCP:53

o SMTP on TCP:25

o Shared Service Provider web service calls on 56737 & 56738 (SSL).

In Wireshark

o Use “follow by tcp stream” to look for time duration, hiccups

o Filter by “tds.size>0”, “ip.dst eq 10.98.88.234”, …

o Look into packet details like sequence, offset and so on

 
Using the above steps you can disect the communication between the servers and pin point the cause or track down the server, which is culprit for the poor performance of the application deployed on to the SharePoint farm.

Once the cause is identified, we can perform the following

Deep Dive Analysis using one of the below method as applicable


• Code profiling

• Third party tools like idera to identify the component quickly

• System tools like perfmon

• Track Un Ghosted Pages: ghost hunter tool

• SQL Profiler

* Look at other performance related blog at my site

References:

Jun 2, 2010

SharePoint Page performance based on component performance

When navigating to a Sharepoint site home page or any other page and it seems to take ages before the page loads, there can be multiple reasons but the one's we are focusing here is at the component level.

A SharePoint page can consist of many parts like
  • htlm controls
  • web controls 
  • webparts
In some scenario, few pages on the site are slower compared to others or all the pages are slow regardless. To find that the bottleneck is one of the component listed above, we can go ahead and use the trial version of Idera tool. We can also use the code profiling but this tool can help us to do the profiling of the component which are slow instead of profiling all components.

It displays the result as follows:


As you can see in the above screenshot, the components are slow but not one particular most of them are slow. Which means, instead of focusing on one component, we need to take a look at the overall communication between the servers in the farm.

On the otherhand, if we would have found slowness with one particular component or few components then we can go ahead with profiling, code review, memory leak and so on.

If we are looking at the overall slowness or other issue please check my others performance related posts.

May 31, 2010

SharePoint 2010 - Browsing to site gives a blank page (on server).


Issue:
          Browsing to the site results in blank page

Solution:
         
1) Go to Central Admin > Application Management

2) Click on "Configure Alternate Access Mapping" as shown below


3) As shown below, make sure the internal url is same as the external url (in this case http://localhost/)

Conceptually,
* Internal URL represents the incoming request to the website.
* PublicURL for Zone represents the outgoing response URL..

In otherwords, Incoming request can be different (like http://... or https://...) but when the response is sent it will be represented by a single URL (like https://...).

May 13, 2010

Creating Graphs or Charts in SharePoint and WSS Lists ( sparklines )

Sparkline are small graphs which generally indicates the trends or variations associated with entities like stocks, temperature, currency and so on. Nothing can express better then a picture itself (Note: Typo for the Temperature in the screen shots)

Implementation Steps

1) Create the SharePoint List or Document Library with the require data as shown below



2) Add some calculated fields like average, max, min in the List as shown below


In similar fashion calculate the Minimum and Average using the formula field.

=Min(January,February,March,April,May,June,July,August,September,October,November,December)

=Max(January,February,March,April,May,June,July,August,September,October,November,December)


3) Create a calculated column called "variation", which will have the chart populary called Sparkline

Add the following formula, as shown in the screenshot below:




i.e. ="<DIV><IMG src='http://chart.apis.google.com/chart?cht=bvs&chs=200x125&chd=t:"&[January]&","&[February]&","&[March]&","&[April]&"............................&chco=4d89f9,c6d9fd&chbh=20&chds=0,100' /></DIV>"

4) Create a View having the following columns
           City, Variation, Min, Max and Average
    Navigate to the View and it will appear as shown below:

 

5) Edit the Page and add Content Editor Webpart at bottom of the page in hidden mode with the following source

6) Now the Sparkline Graph should appear as shown below




OR

References

http://code.google.com/apis/chart/docs/making_charts.html

http://viralpatel.net/blogs/2009/04/generate-pie-bar-line-charts-using-google-chart-api.html

May 6, 2010

SharePoint Portal does not render properly in Internet Explorer or Internet Explorer Crashes for SharePoint Portal

Portal does not render the content pages properly, although the master page is coming quite well.

We tried bunch of things, like setting the IE to default settings, looking into the logs, Javascript Error and so on.

What worked is starting the Internet Explorer in safe mode ....

Click Start > Run > iexplore -extoff


Update:

Internet Explorer Crashes, when clicking on items in the document library.

This generally occurs, when we update office from 2003 to office 2007, or lets say downgrade office 2007 to office 2003 or some other office 2007/2003 related installs.

Either use
Click Start > Run > iexplore -extoff

or apply the following patch if possible

Microsoft Hotfix link




If this wouldn't have solved the issue, I would have rather started the client machine Operating System in Safe Mode, so that only basic components are loaded and anything customized or configured because of the other applications are not loaded.

May 3, 2010

Measuring Application Performance on Windows Server and the Key Perfomance Counters or Indicators

The performance counter data helps determining system bottlenecks and fine tune the application performance. We can utilize the "perfmon utility" on the server. Start > Run > Perfmon and this brings up the perfmon console. Other testing tools which can gather performance counters are Load Runner, VSTS, ...

Steps to measure perfomance counters using out of  box "Perfmon":

1) Download the following "Performance Monitor Wizard" on your server

2) Execute the wizard by double clicking it, give it a name, select terminal server, select all counters, specify path where to save log file and finish the wizard without starting it. So, now we have configured a perfmon template.

3) Open Perfmon, when you want to collect performance counters

4) Start and Stop the configured perfmon (lets say in our case configured template name is "t") as shown below.







Analyze the collected data i.e. performance counters

In the perfmon, do the following as shown in the below image






Click on the data tab and select the counters as shown below:



Now the graph below shows the performance counter selected:


Few Important Key Performance Indicators or Performance Counters to Monitor

Object                                                   Performance                                   Counter Indicates

Processor                                             % Processor Time/_Total                   Processor use level


Memory                                               Available Bytes                                  Amount of memory available


Network                                              Interface Bytes Total/sec                    Amount of network traffic traveling to & from test client
                                                                                                                      (Network contention).


Memory                                              Memory\Pages/sec                             The number of paging operations to disk during the 
                                                                                                                      measuring interval, and this is the primary counter to watch
                                                                                                                      for indication of possible insufficient RAM to meet your
                                                                                                                      server's needs.



The counters mentioned above can help to find out the possibly the bottlenecks and can help in deciding whether to scale up or scale wide. Generally, thumb rule is processor on an average during peak hours should not exceed 60% and page fault should not be more then 50 per seconds.

Apr 28, 2010

SharePoint Extranet Website using Form Based Authentication (FBA) via SQL Database User Store

Develop Content Management, Business Process Management, etc application onto the SharePoint Site, and the site by default is available via intranet using Active Directory user authentication.

We can go ahead and expose the application on intranet site to the external word i.e. extranet or anonymous user via provisiong a extranet site on top of the existing intranet site. The extranet site can leverage authentication using Form Based Authetication (FBA) mechanism via SQL database as the user store.

Implementation Steps:

1.  Double click C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe and follow the wizard. By default, ASPNET_RegSQL.exe will be using the ‘aspnetdb’ database for storing user data.

2.  Use Asp .Net WebSite Administration Tool to access the aspnetdb created in above step.

Under the website menu, select the option for ASP.NET Configuration.

3.  Modify/Replace connection string and membership provider in the web.config (replace connection string and System.web) by value shown below

<connectionStrings>
<add name="SP_FBA_DB_SQL_CONN_STRING" connectionString="server=2003Server\SQLEXPRESS; database=BP_FBA_DB; Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>

<system.web>
<membership defaultProvider="SP_FBA_DB_AspNetSqlMembershipProvider">
<providers>
<add name="SP_FBA_DB_AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SP_FBA_DB_SQL_CONN_STRING" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false"
passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""
/>
</providers>
</membership>

<roleManager enabled="true" defaultProvider="SP_FBA_DB_AspNetSqlRoleProvider">
<providers>
<add name="SP_FBA_DB_AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SP_FBA_DB_SQL_CONN_STRING" applicationName="/" />
</providers>
</roleManager>

4. Create user FBA_Admin in fba database and users (optional), using the step 2

5. Go to Central Admin in SharePoint

6. Create New Web Application for Intranet

7. Create Site collection using publishing portal template

8. Extend created web application and change zone to extranet

9. Change Web.config for Central Admin, and both web apps created Please Note Central Admin config uses

<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider">
<connectionStrings>
<add name="SP_FBA_DB_SQL_CONN_STRING" connectionString="server=2003Server\SQLEXPRESS; database=BP_FBA_DB; Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>

<system.web>
<membership defaultProvider="SP_FBA_DB_AspNetSqlMembershipProvider">
<providers>
<add name="SP_FBA_DB_AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SP_FBA_DB_SQL_CONN_STRING" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false"
passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""
/>
</providers>
</membership>

<roleManager enabled="true" defaultProvider="SP_FBA_DB_AspNetSqlRoleProvider">
<providers>
<add name="SP_FBA_DB_AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SP_FBA_DB_SQL_CONN_STRING" applicationName="/" />
</providers>
</roleManager>

10. Go to Central Administration > Application Management > Authentication Providers Change Extranet to:





11. Go to Central Administration > Application Management > Site Collection Owners

       Add FBA_Admin as secondary site collection administrator



12. Test Sites, by login to intranet and extranet sites


13. Last but not the Least

       Manage FBA Users via WebParts on your Extranet Site



References:

SharePoint Development or Coding Practices to avoid slow performance (i.e. performance degradation)

Few pointers on SharePoint Development or Coding: Best Practices


  • Http Modules and Http Handlers
    • Know the difference between Http Module and Http Handler before using it
    • HTTP module is always called as part of the page processing pipeline, a poorly designed or faulty module can have a detrimental effect on performance or perceived stability of the environment. Thoroughly test each module for performance before deploying it.
    • Use Custom Http Handlers To Improve Performance in ASP.NET (rarely used)


  • Ghosting vs Un-Ghosting
    • All the Pages in the SharePoint are stored in the SQL database but some SharePoint pages lying in the layouts folders on the server are accessed as is. These pages have null as an entry in the sharepoint database. i.e. Ghosted Pages are not stored in the SQL database, they reside on the SharePoint Server folders. The Ghosted pages become unghosted when we modify them (like using SharePoint Designer).
    • Do not unghost the ghosted pages, as this will contribute in degrading the performance.

  •  Custom Stored Procedures preferred compared to SQL Queries
    • Measure performance using SQL Profiler
    • Keep transact SQL smaller, as these create locks.

  • Create Views
    • When we need to pull data from multiple tables and have complex multiple joins. It's preferred to create the views and write queries on top of it, instead of writing and calling complex queries on demand.

  • SharePoint List Views
    • Use proper Index in the SP List Views, i.e. column used in the filter of the views

  • Web Applications in the Farm (2-2-1)
    • Do not have more then 5-7 web applications in the medium size farm
    • Each web application should have it's own application pool

  • NTLM vs Kerbores authentication
    • Kerberos caches information about the client after authentication. This means that it can perform better than NTLM particularly in large farm

  • SSL (http vs https)
    • SSL mostlty degrades the performance

  • Server Round Trips
    • Code to avoid server round trips

  • Views Size
    • Views size should not be more then 2000 items.


 coming more soon ...

Apr 21, 2010

SharePoint Performance Tuning

To improve SharePoint Performance, as a site or collection or farm administrator you can:
  • Enable Output and Page Caching from Site Admin Page.
  • Turn on Http compression and Content Expiration at IIS Level (Browser Caching and content compression)
  • Turn on Blob Caching on all WFE Servers, In web.config (look for blobcache and make it true)
    • < BlobCache location="C:\blobcache" path="\.(gif¦jpg¦png¦css¦js)$ " maxSize="10" enabled="true" />
  • Use Warmup script
  • Use SharePoint Dispose Check utility for memory leak
  • Can use Ant profiler for memory issues or to find out memory bottlenecks.
  • Hardware in the farm                   
    • 32 bit vs 64 bit, what is the server memory metrics. Use 64 bit if the memory consumption is more then 50% and you have hit the 4 GB limit on the 32 bit operating system.
  • Load test via Visual Studio Team Suite or link
  • Collect server metrics using perfmon
  • Look for the Network Contention (most common),
    •  network in the farm (NIC card, etc)
    •  network bandwidth between the farm and client
  • Best Development and Coding Practices to avoid slow performance (i.e. performance degradation)
    • Custom Code (Object Model)
    • SharePoint Farm (Architecture / Hardware / Software)
  • Use SQL Profiler to determine if database is the bottleneck

          Apr 19, 2010

          SharePoint Slow Performance and Warmup script (Object Model or WebRequest)

          SharePoint Sites are slow, duh!

          Well, we need to resolve the bottleneck ...

          If sharepoint site is slow always? follow the link

          OR

          If the sharepoint site is slow only during the wee hours or certain time of a day?

          Do the following:

          * Recylce appliction pool on Web Front End Servers at different time of the day and just before peak hours.

          * Object Model vs Web Request, what to use in the warmup script?

                - Object Model can be used when you don't know your highly accessed page and the new sites are created or deleted frequently i.e. configurtion files does require frequent changes. warmup script link

                - Web Request does not enumerate sites automatically in the farm and you need to add the url's of highly accessed page explicity. In other words, if you create new site; add the url manually to the configuration file. warmup script link

          * From the warmup script access frequently accessed page, so that it's cached after application pool recycle.

          UPDATE: customized pages are parsed (by IIS) using no-compile mode, so accessing the unghosted pages won't help much
                            highly accessed pages should be deployed as ghosted pages onto the sharepoint if performance matters
          * Check IIS configuration, it might be recycling the application pool automtically based on the size of worker process


          Related Topic:
                                        SharePoint Workflow and Warmup Scripts

          Apr 12, 2010

          What to do when Ouput Caching, Page Caching does not improve performance (SharePoint)?

          What to do when Ouput Caching, Page Caching does not improve performance (SharePoint)?

          Points to ponder:

          • how the site was created 
          • when you enabled the publishing infrastructrue
          • when the site or page was created before or after enabling publishing infrastructrue
          Have an existing Site based on a template other then Publishing Template and you want to enable Ouput Caching and Page Caching .

          Even if you go ahead and enable the Output caching at the site/site collection level after enabling publishing infrastructure etc. The Caching will not work for the existing pages.

          Check If Output Caching is working or not?

          Enable debug cache information in the cache profile, a comment will be left at the end of the HTML markup of the web page indicating if output caching is enabled.

          This option is really for debugging purposes, and it is not required to enable output caching.
          It tells you what profile the page is using to cache the content, and the timestamp of the cached version of the page.

          You should be able to see the (IE > view Source > at the bottom)

          <!-- Rendered using cache profile:Public Internet at: 2006-11-03T14:38:59 -->

          at the bottom of the page for the site you created under site collection using the Publishing template "Publishing Site" or Pages created after enabling Publishing Infrastructure.
          So, even if i go ahead and enable the Output caching at the site/site collection level after enabling publishing infrastructure etc. The Caching will not work for the existing pages and they won't have something like "<!-- Rendered using cache profile:Public Internet at: 2006-11-03T14:38:59 -->" at the bottom. Although, this will work for newly added pages after enabling Publishing Infrastructure.

          Apr 10, 2010

          SharePoint Analytics or SharePoint Usage Reporting or Google Analytics SharePoint

          world full of options ... what to choose ..

          SharePoint Usage Reporting provides:
          • Requests and queries in the last day and the last 30 days.
          • Average number of requests per day over the last 30 days.
          • A chart of requests per day over the last 30 days.
          • A list of top users over the last 30 days.
          the list goes on and on ...

          SharePoint Usage Reporting, yes it's not complete web analytics but out of box it does provide features which are comparable to web analytics.

            To turn on SharePoint Usage Reporting:

          1) Turn on usage analysis processing in Central Admin under operations

















          2) Turn on usage reporting in Share Service Provider




          3) Enable Publishing infrastructure at site collection level

               http://celerity12.blogspot.com/2010/03/sharepoint-outputpage-caching.html


          Then goto SiteAction > Site Settings and click Site Collection usage.





          SharePoint Server Updates or Versions ( i.e. Service Packs, Hot Fix, Patch, Cummulative update) all at one place

          SharePoint Updates

          Came across with scenario, when we have bunch of update requested by different teams, some requiring hot fix for infopath, some one for SSP and so on. The best solution is to keep the SharePoint Server Farm updated with all the cumulative updates, this can be or should be tracked at the below link

          SharePoint 2007 Updates link

          SharePoint 2010 Updates link

          Keywords: SharePoint SP2

          Apr 8, 2010

          Hide View All Site Content on SharePoint Site

          At times we need to hide certain things on the master page based on the user profile.

          You might be finding blogs where people are coding or making these components invisible or commenting or deleting to hide them, Instead the method mentioned below is the correct way of doing the following:

          • hide View all site content
          • hide bread crumbs
          • hide My Links
          • hide My Site
          • hide help
          • hide left navigation

          Highlighted below in the screen shot (logged in as site administrator):


          Instead, simply open the master page using SharePoint Designer and using the split view
          as shown below in the screenshot highlight the desired component to hide, in the example below i am using "My Site"


          Now, lets add few lines to hide "My Site"

          <Sharepoint:SPSecurityTrimmedControl runat="server" Permissions="ManageSubwebs">


          <SharePoint:DelegateControl ControlId="GlobalSiteLink1" Scope="Farm" runat="server"/></td>

          </Sharepoint:SPSecurityTrimmedControl>

          as shown below:

          Now login as the Site Administrator and some other account like site members.
          Notice the difference, the My Site is gone.

          Logged in with site member account


          Code only when necessary!

          keywords: SPSecurityTrimmedControl

          Apr 5, 2010

          SharePoint Performance (IIS Http Compression and content expiration)

          SharePoint Performance improvement by using IIS Http Compression and content expiration

          Sites will be simply faster

          Implemented http compression and content expiration, on IIS hosting the SharePoint sites and the page load time decreased to 3 seconds from around 6+ seconds.

          To Improve SharePoint Site performance, one of the tweak you need to do is Http Compression at IIS Level

          Benefits:

          • Effective bandwidth utilization, Conserve traffic and server resources
          • Faster transmission between Client/Server
          • Compress Static files, Compress Application response files (dynamic compression)

          Performance Metrics

          Before and after Implementing Http Compression on the Server Farm, following baseline metrics needs to be collected:

          * CPU Usage under certain load or at certain times during the business hours
          * Memory Usage under certain load or at certain times during the business hours
          * Server Response time (Http Watch/ fiddler can be used)
                   - This will help in making a decision, whether we can apply the dynamic compression or not.

          Enabling HTTP compression,

          1. In IIS Manager, double-click the local computer, right-click the Web Sites folder, and then click Properties.

          2. Click the Service tab, and in the HTTP compression section, select the Compress application files check box to enable compression for dynamic files.

          3. Select the Compress static files and Compress application files check box to enable compression for static/dynamic files.

          4. In the Temporary directory box, click Browse to locate a directory. The directory must be on the local drive of an NTFS–formatted partition.

          5. Under Maximum temporary directory size, click a folder size option.

          6. Click Apply, and then click OK.


          Static file is compressed, and it is cached in this temporary directory until it expires, or the content changes.

          By default following files are compressed for Static compression: .txt, .htm, and .html

          Dynamic files are compressed at runtime, means on demand when they are accessed by the end user. This means each time the file is being accessed the server CPU is under load.

          By default following files are compressed for Dynamic compression: .exe, .dll, and .asp

          Implementing compression (editing the Metabase.xml)

          - Including certain file types

          Static File Types > xml, rdf, css, js

          Dynamic File Types > aspx, xsn, asmx, cgi

          - level of compression

          set to “9” should be changed to find the appropriate value based on the environment CPU utilization

          On the WFE server look for Metabase.xml, located in the following directory: c:\windows\system32\inetsrv

          Open the file and look for the following tags and replace it with the one given below:

          <IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/deflate"

          HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"

          HcCreateFlags="0"

          HcDoDynamicCompression="TRUE"

          HcDoOnDemandCompression="TRUE"

          HcDoStaticCompression="TRUE"

          HcDynamicCompressionLevel="9"

          HcFileExtensions="htm

          html

          xml

          css

          txt

          rdf

          js"

          HcOnDemandCompLevel="9"

          HcPriority="1"

          HcScriptFileExtensions="asp

          cgi

          exe

          dll

          aspx

          asmx

          xsn"

          >

          </IIsCompressionScheme>

          <IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/gzip"

          HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"

          HcCreateFlags="1"

          HcDoDynamicCompression="TRUE"

          HcDoOnDemandCompression="TRUE"

          HcDoStaticCompression="TRUE"

          HcDynamicCompressionLevel="9"

          HcFileExtensions="htm

          html

          xml

          css

          txt

          rdf

          js"

          HcOnDemandCompLevel="9"

          HcPriority="1"

          HcScriptFileExtensions="asp

          cgi

          exe

          dll

          aspx

          asmx

          xsn"

          >

          </IIsCompressionScheme>

          <IIsCompressionSchemes Location ="/LM/W3SVC/Filters/Compression/Parameters"

          HcCacheControlHeader="max-age=86400"

          HcCompressionBufferSize="8192"

          HcCompressionDirectory="%windir%\IIS Temporary Compressed Files"

          HcDoDiskSpaceLimiting="FALSE"

          HcDoDynamicCompression="TRUE"

          HcDoOnDemandCompression="TRUE"

          HcDoStaticCompression="TRUE"

          HcExpiresHeader="Wed, 01 Jan 1997 12:00:00 GMT"

          HcFilesDeletedPerDiskFree="256"

          HcIoBufferSize="8192"

          HcMaxDiskSpaceUsage="99614720"

          HcMaxQueueLength="1000"

          HcMinFileSizeForComp="1"

          HcNoCompressionForHttp10="FALSE"

          HcNoCompressionForProxies="FALSE"

          HcNoCompressionForRange="FALSE"

          HcSendCacheHeaders="FALSE"

          >

          </IIsCompressionSchemes>


          * Ignore br tag

          NOTE:

          -- Cannot edit or save the IIS metabase.xml file
          To edit the IIS metabase file without stopping IIS, you must enable Edit-While-Running.

          Procedure:

          - To enable metabase edit-while-running using IIS Manager

          - In IIS Manager, right-click the local computer, and then click Properties.

          - Select the Enable Direct Metabase Edit check box.

          Instead of editing “metabase.xml”, we could use the following command but it doesn’t seem to work quite well.

          cscript.exe adsutil.vbs …


          Enabling Content Expiration for Client (Browser) Caching

          In the IIS Manager, right click on the website and goto properties as shown below

          One you have the settings as shown above, i.e.

          - Enable content expiration checked mark

          - Expire after should be set to around 30 days or based on application

          - Under Custom Http Headers should have the following via edit

          - An example of a Cache-Control server-response header is

          o Cache-Control: max-age=3600

          o Cache-Control: max-age=3600, must-revalidate

          The must-revalidate attribute speeds up the caching process by rendering the repeated download of entire pages or objects unnecessary. If the data's freshness is unknown, the browser can contact the server to determine whether an update has occurred. If no changes to the object have occurred, the browser uses the cached copy.

          § Time is in seconds

          Restart the IIS before testing the performance for your sites and comparing the baseline metrics.



          NOTE You should consider testing the impact of compression levels and monitor the CPU utilization and potential impact to your Web servers. Generally, a compression level between 7 and 9 provides optimum performance


          Testing:

          Open the site using IE and enable the recording in the httpWatch, you should see something like following when navigating to home page (default.aspx):

          Also look at the content in the next screen shot below:



          Validate content expiration for pages other than some like default.aspx as shown below:

          NOTE: At last but not the least, The above procedure needs to be implemented on all Web Front End (WFE) servers in the SharePoint Farm

          For other performance tips follow SharePoint Performance Tuning

          Apr 4, 2010

          Office 2007 Ribbon

          User Interface: Content Area Utilization (Office 2007 / Browser / ...)

          In Office 2007 to get more content area make the ribbon hide when not in use, by right clicking on the top menu bar and choose "Minimize the Ribbon"

          People who really use Office 2007, seems to realize that it has much better User Interface then previous Office versions.


          Most of the web sites are standard for resolution 1024 x 784, to make sure all the viewers can browse them with the optimum content area utilization on the screen. As the screen sizes are increasing and some people tend to use higher resolution, we do have some area left, on the left and right inside the browser as the blank vertical rectangle.

          Why not utilize the screen area by the floating toolbars or application? Maybe Windows Sidebar, ...

          The Office 2007 story of Ribbon link

          Apr 1, 2010

          Add aspx page to SharePoint WebPart

          When developing webparts in sharepoint we are limited in various ways, unleash the complete power of asp .net / visual studio by creating asp .net user controls and wrapping it in a webpart.

          Objective: Encapsulate asp .net user control (.ascx) in a webpart, with complete wsp deployment.

          WebPart The above visual studio solution will work as a template to quickly create the asp .net user control and wrap it inside a webpart.

          Steps Use the template (source code link at the bottom of this blog post) and create asp .net user control webpart for SharePoint.

          1) Open Visual Studio

          2) Create Asp .Net Web App Project

          Click Here to download the Visual Studio 2005 Web Application Project Preview (RC1) link,


          3) Delete Default.aspx

          4) Create a folder/file structure similar to



          5) Copy files as shown below



          6) Strong sign the key under properties

          7) Change the namespace in all the .cs and ascx files in the project and also modify the properties of the solution as shown below

          8) Copy the contents of the following file from the downloaded project template to the project you are creating


          Files are:
          CreateSolutionPackage.cmd
          JQueryWebPartDemo.ddf
          Manifest.xml
          Elements.xml
          Feature.xml
          Main.cs
          JQueryWebPartDemo.dwp
          WebUserControl.ascx
          WebUserControl.ascx.cs

          Change the namespace, solution id (new guid), public key token (in further steps down), feature id (new guid) in all the above files

          Names are kept similar to make sure; the replacement is easy across the files

          9) Build the project and go to the bin folder

          10) Use "Visual Studio Command Prompt" (Start >> Microsoft Visual Studio 2010 >> Visual Studio Tools >> Visual Studio Command Prompt (2010))

          11) OR In case you aren't using the VS Command prompt, you can locate sn.exe at %ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\sn.exe

          12) sn -T "C:\Documents and Settings\seimossadmin\Desktop\sp.test.wp\sp.test.wp\bin\sp.test.wp.dll"

          and update the public key token in all files as required

          9) Web Part file, the highlighted portion is public key token of the dll



          10) The part in red box should be modified (similar to web.config safecontrol entry)


          11) Change all guid’s like solution, feature

          12) Under Properties> Build


          17) Build the Project


          18) Go to the folder where you have setup.exe in the project folder

          19) Change the setup.config.exe for correct wsp name and solution id.

          20) Run CreateSolutionPackage.cmd

          21) Run Setup.exe and install.

          22) Make sure wsp timestamp is the latest


          You Tube Link:

          1) Implementation Doc

          2) VS 2005 Doc



          Download the user control webart source code or example link,

          Happy Coding ...

          App pool recycle or IISReset and Running Warmup Script

          IIS Application Pool Recycle: Is Warmup script accessing home page only enough?

          IIS App pool generally gets recycled once a day, to make sure the end user access to site in terms of  performance doesn't drastically degrades, we need to have caching as well as warmup script setup correctly.

          FACT:
          Warmup script should hit the most frequently accessed pages of the sites instead of just accessing the site collection or home page.

          REASON:
          So that after the app pool recycle / iisreset the cache is created again and subsequent access of the site pages are retrived from the cache as applicable, instead of building the cache and slowing down the pages access further after the iis reset / app pool recycle.

          Mar 30, 2010

          Enabling Publishing Infrastructure throws error message: Access Denied

          To leverage the Output or Page Caching feature of SharePoint 2007, we need to enable publishing infrastructure onto the website.

          At times when using the Site Level Admin Console to activate this feature, it fails giving error message.




          This is when you use stsadm commandline utility onto the SharePoint Server as follows:

          stsadm -o activatefeature -name PublishingSite -url http://sitecollectionurl/


          SharePoint Enabling Output and Page Caching prerequiste is the publishing infrastructure.

          Now, as a site collection administrator you can:
          • Enable the Office SharePoint Server Publishing  feature from Site Features
          • Enable Output Caching and Page Caching from Site Admin Page.

          Mar 26, 2010

          Backup Restore SharePoint or Restore SharePoint Site

          SharePoint Sites like TeamSite, Collabration Site, Blank Site... with or without extensive custom code customization in functionality, can be moved from one server farm to another regardless of the farm size. This is obviously not the best practice but based on the external/internal factors in an organization, can be persued and sites can be migrated. BTW, undoubtely with hands up this is by far the winner when it comes for POC sites.


          Came across different organization/people of all level and they spent hours trying different options, but finally what worked is (the following process proposed by me):

          stsadm.exe -o restore -url "URL" -filename "filename" -overwrite -restoremethod new

          Before executing the above command:
          * Create a site collection with blank site
          * Install all the third party webparts/templates
          * Deploy all the custom code (wsp) to the farm
          * Make sure SharePoint Version is same

          The backup might be taken using the one mentioned below method or any other way:

          stsadm -o backup -url  "URL -filename "FileName"

          Other available options:
          * Central Admin Backup/Restore
          * SharePoint Designer, Yes the SPD
          * Stsadm import/export
          * SQL Content DB backup/restore
          * Site templates
          * and so on

          Success rate almost 100% when you are using stsadm restore. Even though stsadm restore is not meant for migration but it serves the purpose.

          Update:

          Migrated a Highly Customized SharePoint Portal from one farm to another farm using the above technique.

          Mar 25, 2010

          SharePoint Workflow and Warmup Scripts

          TOPIC
          SharePoint Workflow creates task in the associated task list, once it's been initated and thereafter to have the status available for endusers . Can also do custom work like updating a custom database table, sending emails and so on.


          SCENARIO
          We had a scenario, where the first user every day faces the issue caused because of the workflow taking long time to update the custom database.


          RESOLUTION
          The Application pool for the SharePoint Web Application gets recycled on nightly basis. So, the caching is not there any more and we need to warmup the SharePoint Workflow Engine.

          Create a custom aspx page and initate a workflow on calling the aspx page which will try to start the workflow and eventually fail. This way we will atleast warmup the SharePoint Workflow Engine.

          Mar 23, 2010

          Create SharePoint Site

          Quickly Create SharePoint Intranet Site using SharePoint Designer and Out oF Box features

          Need to create a sharepoint intranet site for a department / team, the following points will expedite the site creation:

          Tools/Access Required

          - SharePoint Farm Administrator privilege
          - SharePoint Site Collection Admin privilege
          - SharePoint Designer
          - IE Developer Toolbar

          Basics

          - Make sure SharePoint server is upto date (All SharePoint 2007 Updates)
          - Create a blank site, use managed path specific to the department or team

          - Enable Publishing Infrastructure
          - Install WSS Fab 40 Template
          - Create desired page layout for default.aspx using SharePoint Designer (SPD)
          - Sample website link
          - Enable site usage reporting at Site Collection Administrator Level
          - Create Groups as required and use audience targetting in the webparts as required


          Look and Feel

          - Use pre existing theme
          - Write CSS inside Content Editor WebPart for the Content Area / Page Layout.
          - Use SharePoint Designer to write inline CSS for the Master Page

          Customize MasterPage / Default.aspx (Home Page)

          - Embed logo images via SPD as required
          - Hide components
              -- View All Site Content
              -- Site Actions
              -- Left Navigation
              -- etc
            by using the following tag as the wrapper around what you want to hide



          SharePoint:SPSecurityTrimmedControl ID="Control2" runat="server" PermissionsString="ManageSubwebs"


          Now here is the description what we had done.
          SPSecurityTrimmedControl as the name suggest, the control check the SharePoint permission and if user is permitted (if the user have permission) then it will access the content inside this control.
          And if the user don’t have a permission then the content inside this control will not been accessed.

          Page Content

          * Free Third Party World Clock and Weather WebPart

          * Free Third Party Stock Ticker WebPart

          * NEWS/RSS Ticker WebPart (mostly at the bottom of the page)

          Add a RSS WebPart to the page and open the tool pane.

          Goto XSLT Editor replace the existing XSLT from the following blog's XSLT ...

          link

          Set the property of RSS WebPart and you are all set.

          Tip: Generate custom XSLT for SharePoint using SharePoint Designer (SPD)

          * Use DataView WebParts for showing snippets from blog / tasks / lists in a customized manner

          * Add a Calender webpart for Upcoming Events

          * Use RSS WebPart to recieve news

          * Use a List WebPart, rename it to My Bookmarks/My Links. i.e. Create a View and customize the view to have only one column called detail link and in the where condition use [Me]

          * Use SPD to have Page Hit Count

          Post your comments if you find something missing ... and yes don't forget to add the following:

          Footer

          - Feedback - link to a List View
          - Contact Us
          - Copyright
          - Terms of Usage and so on

          SharePoint Warmup Script for Extranet or Intranet Site

          Sharepoint Warmup Script Myth DeMystified

          Accessing SharePoint Site in the morning is like warming up the car on a cold winter morning before you can expect optimal performance on takeoff.

          SharePoint Site resources are recycled from the server memory by default IIS configuration on a regular/nightly basis similar to the concept that after driving certain miles you need to re fuel your car.

          To keep things notch up, like cars which start automatically when the temprature falls below cetain fahrenheit. For SharePoint we need to schedule warmup script to run automatically when the application pool memory gets recycled.

          SharePoint Sites are hosted on top of WSS, which runs on top of .Net framework hosted on IIS Servers. Same like cars have different types of engine but basically they move the piston/wheel. Abstraction is the key, if you note above.

          In a scenario, where you have a 2wd/4wd car still you have to make sure to warmup the engine for optimum performance. Same is the case with SharePoint, (for a given Site) whether it's the Extranet / Intranet Site URL both uses the same Site Collection (and also the same application pool) to access the information need to be displayed to the end user.

          From the above you can note that in your warmupscript whether you access the intranet url or extranet url, it doesn't make any difference both works exactly the same helping the ASP .Net JIT compilation and hence site performance doesn't degrade drastically during the wee hours of the morning.

          You can use the well known warmup script located at: link

          Mar 16, 2010

          SharePoint Performance or SharePoint Optimization - Real Time Data

          A Share Point Site mainly using forms, workflows, custom views, custom master page, and interacting with custom application database on SQL Server. Users are authenticated via FBA using LDAP.

          Time to load the site is:

          1) After IISReset, Browser cached cleaned, logged onto the server itself and using (127.0.0.1 in host file for the URL)

          around 34 Seconds

          2) After Warmup Script, IISReset with browser cached cleaned on the server itself and using (127.0.0.1 in host file for the URL)

          around 21 Seconds

          3) Subsequent access after closing and reopening the browser only

          No IISReset, No Browser cache cleaning

          around 11 Seconds


          Environment: IE 6.0 on 64 bit box 2GB Ram and only one web app in the farm (1 App Server, 1 Web Server, 1 DB running on VM)
          Win 2003 SP2


          To Improve the Performance further Enabled the following caching:
          * Caching at IIS Level
          * Enabled BLOB caching via web.config (Does caches some 30 kb of data)
          * Enabled http compression for static and dynamic files at IIS level (Does caches some 40 kb of data)
          * Enabled Output Caching or Object Caching at the Share Point Site Collection level
          * Warmup script from codeplex

          Performance improved to around 5 seconds.

          Mar 15, 2010

          WSS (Windows SharePoint Services) or SharePoint

          Have your Web Portals, Content Management and Business Process Management Workflows without having to pay for SharePoint just use Windows SharePoint Services (WSS) a free add-on to Microsoft Windows Server 2003 and 2008.


           
          SharePoint can be adopted slowly to it's complete strength instead of being overwhelmed by the complete list of feature provided by SharePoint. Some scenarios even might not require complete SharePoint they will work just fine using only WSS.
           
          WSS Features

          • Content Management system.
          • Document Management providing a central repository for shared documents
          • Web-based collaboration, collaborative editing of shared documents, and document workspaces
          • Workflows
          • Access control and revision control for documents in a library
          • Browser-based management and administration.
          • Customizable web pages using dashboards, web parts, and navigation tools
          • .... and many more

          Jan 5, 2010

          SharePoint Lists vs Database (RDBMS)

          SharePoint is not meant to replace database, SharePoint is evolving as a "Enterprise Content Management and Collabration" Software or Application Development Platform depending on the target audience.

          SharePoint List doesn't support
          1) Relationship (other then simple relationships)
          2) Transactions

          SharePoint List supports
          1) Indexing
          2) Sorting
          3) Filtering
          4) Views

          There are some third party tools (like SLAM), which helps in making relationships between lists. But keep in mind they have limitations and performance issues as SharePoint is not a RDBMS. We can't fly a passenger plane to moon, you need a rocket.

          Pages