Friday, May 13, 2011

Tips for Anonymous site in SharePoint 2010

These are some tips to publish your site with anonymous access.
  1. From Central Administration >> Web Applications Management >> then select your web application >> Authentication Providers >> Select the zone which publish it to the internet (In my case is Default Zone) >> Enable anonymous access
2.  Then open your site collection and go to Site Settings >> Site Permissions >> Anonymous Access (top in Ribbon) >> Select Entire Web site.
3.  Make sure all pages, master pages , layouts , images ,item style and css have published (Checked in and Published).

4. If you have a page in layouts folder (14-hive folder) then make sure the page inherence from System.Web.UI.Page not other namespace and class (like LayoutsPageBase).

5. If you have Client Object Model (ECMAScript) in your page make sure to run the following script to remove the striction from SharePoint 2010 with anonymous access (be careful when you are using Client Object with anonymous access to access any sensitive information )

$wa = Get-SPWebApplication -Identity "http://SiteCollectionUrl"
$wa.ClientCallableSettings.AnonymousRestrictedTypes.Remove([Microsoft.SharePoint.SPList], "GetItems")
$wa.Update()

6. If you have for example a page which insert an item to custom list and you need to enable the user insert the item anonymously you have to break the permission of this list from list Settings >> then Select Permissions for this list and then Click on Anonymous Access and Select Add Items permission.

7. Avoid Operation of attaching a workflow (ex. SharePoint Designer workflow) with the item insertion or uploading file because these functions not work properly in anonymous access.

8.Finally to access the site via mobile device and avoid the unauthorized page error or to browse the site same as normal browser so just past this configuration in web.config of Web application under system.web section

<browserCaps>
  <result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
  <filter>isMobileDevice=false</filter>
</browserCaps>

Friday, May 6, 2011

Some techniques Help you to test the connection of SQL Server between the Servers

Sometimes I faced problems while installing SQL Server and Configuration the Farm and these problems happened between the connection of SQL Server and frontend servers. These problems sometimes related to ports , firewall or these server internally and the others in DMZ etc… so these are some techniques will help you to test the connection and find out which port is used by SQL server.



For example to check which port currently used by SQL Server you have many options:
  1.  Go to regedit and the registry key for SQL Server instance name
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQLServer\SuperSocketNetLib\Tcp\IPAll




Note: there are two different type of ports in SQL server:

a. Static port: by this option you select specific port and always SQL Server uses this port to listen to the connection.
b. Dynamic port: by this option each time SQL Server restarted it will assign a new port if the last used port closed or not available.

2.Go to SQL Server Configuration Manager >> SQL Server Network Configuration >> Protocols for [Instance Name] >> TCP/IP then right click and select properties



3.Use this Query


use master
go
Xp_readerrorlog




4.Use this Query (this query return information about the connection established to this instance of SQL Server)



select net_transport,local_tcp_port from sys.dm_exec_connections

5.Go to command prompt and run this command which return the list of listened and established prots


netstat –a

6.To test the connection between the servers for example login to frontend server to see this server can connect to SQL server .Go to Control Panel\All Control Panel Items\Administrative Tools and click on Data Sources (ODBC) and try to connect to the instance name.

7.To test the connection also you can use the following steps:
    a. Create abc.udl text file (extension .udl)
    b.Double click to this file and then select the provider and enter the connection information



Last notes:
  1. when you test the connection, port... first check it locally in SQL Server server and make sure you can connect to SQL Server
  2. when you install SQL Server the default port used is 1433.
  3. try to check if you can connect to SQL Server from other server internally or externally and if you face any problems always check the connectivity between the servers and the firewall.
  4. there are also other options to check the ports and the connection between the server like telnet ,look@me and other third party tools.