When I used the authtype clientsecret for the console application, it worked, however for the web application, (authtyp) AD was changed automatically insted of clientSecret and it is not working. Please help how can i achieve on asp.net mvc web application.
Note : The same code runs successfully on a console program but fails on a web application.
Please find my code below.
Connection String :
<connectionStrings>
<add name="MyCrm1" connectionString="authtype=ClientSecret;url=https://fake.crm11.dynamics.com/XRMServices/2011/Organization.svc;clientid=fd0a8505-e559-4145-b1c8-929d0c9e0ce1;ClientSecret=CVm8Q~hfG0K1Itm-CSGWk1dOtO54T2ghPHmlNc7K;LoginPrompt=False;redirectUri=app://fd0a8505-e559-4145-b1c8-929d0c9e0ce1;"/>
</connectionStrings>
ASP.net MVC C#
private static IOrganizationService _crmServiceClient()
{
using (var connection = new CrmServiceClient(_connectionString))
{
if (connection.IsReady)
{
_service = (IOrganizationService)connection.OrganizationWebProxyClient != null ? (IOrganizationService)connection.OrganizationWebProxyClient : (IOrganizationService)connection.OrganizationServiceProxy;
}
}
return _service;
}

Can I ask you why do you need this helper code:
Your connection implements IOrganizationService interface so can be perfectly used for any kind of CRUD and Execute operations.