Code
To enable anonymous access in sharepoint 2010 site.

Go through the following steps:
  1. Code
    Open the Central admin site of your sharepoint  server , click onApplication Management> Manage 
    WebApplication.
  2. Code
    Now select Your Web Application which you want to enable anonymous ,
  3. Code
    Click on Authentication  Providers, Click checkbox selected for enable anonymous access
  4. Code
    Now click ok, then click  on anonymous Policy icon in ribbon in central admin site..
  5. Code
    Select Anonymous User Policy , I selected none for my purpose…
  6. Code
    Now Open Your web application,  go to site action menu, site permission,
Code
Click on Anonymous Icon in Ribbon, Then select the Entire Site/Lists as per your requirement , click ok

Your site has been enabled with anonymous access….