Home > MSCRM General > HTTP status 401: Unauthorized errors

HTTP status 401: Unauthorized errors

If you are a victim of “HTTP status 401: Unauthorized error” then please try the following tip. It may work for you.

To cache the credential of users PreAuthenticate property of both CRMService and MetadataService is used. But sometimes this behavior causes “HTTP status 401: Unauthorized errors” Error. Therefore, Microsoft recommends avoiding the PreAuthenticate property in your code at this time.


  1. ssa
    February 16, 2007 at 10:30 am

    Thanks 🙂

  2. Susan
    March 16, 2007 at 7:29 am


    i am also getting th same error when I use crm service.

    Please can u help me out????

    i have spent over 5 days in the same.

    Server Error in ‘/CRMCUSTOM30’ Application.


    The request failed with HTTP status 401: Unauthorized.

    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information
    about the error and where it originated in the code.

    Exception Details: System.Net.WebException: The request failed with HTTP
    status 401: Unauthorized.

    Source Error:

    Line 40: [return:
    Line 41: public Response
    schemas.microsoft.com/crm/2006/WebServices”)] Request Request) {
    Line 42: object[] results = this.Invoke(“Execute”, new
    object[] {
    Line 43: Request});
    Line 44: return ((Response)(results[0]));

    Source File:
    s\Web References\CRMService30\Reference.cs Line: 42

    Stack Trace:

    [WebException: The request failed with HTTP status 401: Unauthorized.]

    ientMessage message, WebResponse response, Stream responseStream,
    Boolean asyncCall) +1296
    methodName, Object[] parameters) +218
    Request) in
    s\Web References\CRMService30\Reference.cs:42
    Tectura.Util.Crm.Tools30.Product.CreateProduct(String productid,
    String name, String vendorname, String UOMguid, String UOMscheduleid) in
    CRMCUSTOM30.CustomCreateCase.CreateCase() in
    CRMCUSTOM30.CustomCreateCase.lbCreateCase_Click(Object sender,
    EventArgs e) in
    System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)

    .RaisePostBackEvent(String eventArgument)
    sourceControl, String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    System.Web.UI.Page.ProcessRequestMain() +1292

  3. March 16, 2007 at 6:55 pm

    Hi Susan,

    Have u tried the tip in the article.

  4. March 16, 2007 at 6:56 pm

    Secondly, Are you using the proper impersonation and authorization in your code? Is your calling user member of PrivUserGroup?



  5. March 22, 2007 at 4:53 pm

    Hi Ayaz,

    I am experiencing this same error. The interesting thing is that I do not get this error on the development environment, nor do I get this error by running code on the same web server that hosts MSCRM.

    HOWEVER… I am getting it on the staging server.

    This is how I am passing credentials…

    CrmService service = new CrmService();
    service.Credentials = System.Net.CredentialCache.DefaultCredentials;

    Do you have any suggestions?

  6. March 22, 2007 at 10:14 pm

    Hi Robyn,

    Are you using proper impersonation in your code? Is your calling user is a member of PrivUserGroup.

    Impersonation is used to execute business logic (code) on behalf of a Microsoft CRM user in order to provide a desired feature or service.

    Try to imtroduce impersonation in your web.config file by adding following tag:

    this username should be a member of PrivUserGroup.

    You can even introduct impersonation in your code as follows:

    CrmService myService = new CrmService();
    myService.Url = “http://localhost/mscrmservices/2006/crmservice.asmx”;
    myService.Credentials = new NetworkCredential(“PrivUserName”,”PrivUserPassword”,”PrivUserDomain”)

    For in detail description of security groups (PrivUserGroup) please check
    this post:

    Hope this helps,


  7. Susan
    April 11, 2007 at 9:48 am


    I am creating an account using the crmservice.
    It is created when user clicks on a custom create button on the toolbar.
    Using the service the ownerid & createdby felid is always that of the system administrator whereas it should b of that user who has logged in the CRM Environment through the web client.

    In some cases it also gives 401 UnAuthorised Error.

    Pls help me out.
    Thanks in Advance.


  8. Chaksey Thomas
    April 12, 2007 at 1:54 pm

    I tried printing from my fourth shifett application. In the SSIL query window, i get the ffl. error message:

    “Error in getting report parameters: System.Web.Services; The request failed with HTTP status 401: Unauthorized.

  9. Chaksey Thomas
    April 12, 2007 at 1:55 pm

    sorry I meant FOURTH SHIFT application

  10. April 16, 2007 at 2:17 pm

    It worked. Thank you so very much!

  11. Ashwani
    May 2, 2007 at 10:58 pm

    Hi Ayaz,

    I am also getting this error, the code works fine when i use
    CrmService myService = new CrmService();
    myService.Url = “http://localhost/mscrmservices/2006/crmservice.asmx”;
    myService.Credentials = new NetworkCredential(”PrivUserName”,”PrivUserPassword”,”PrivUserDomain”);

    but gives unauthorised error ,when using
    myService.Credentials = System.Net.CredentialCache.DefaultCredentials;

    I have set impersonate=”true” in web.config file also.

    Please help.
    Thanks in advance.

  12. May 2, 2007 at 11:30 pm


    Please use impersonate=”true” and also set impersonating user and password in web.config file because when you only specify Impersonate = “true”, calling user is used while impersonation. your calling user may or may not have the rights to create the CRM Service object (part of privUserGroup).

    Hope it helps,


  13. Ashwani
    May 3, 2007 at 12:54 am

    Hi Ayaz,

    Thanks for the quick reply.

    If i set the impersonate user name and password, then how can i get the current logged on user to assign the create entities to that user.

    Everytime it will give me the user i used in web.config file and will assign all the records to that user.

    Is that true?

    Thanks once again for your help.

  14. May 3, 2007 at 7:43 pm

    Hi Ashwani,

    You can even switch between calling user and impersonating user in your code. For this you need not to mention impersonating user in web.config. Simply use the following code to impersonate when required and get back to calling user otherwise.

    public const int LOGON32_LOGON_INTERACTIVE = 2;
    public const int LOGON32_PROVIDER_DEFAULT = 0;

    WindowsImpersonationContext impersonationContext;

    public static extern int LogonUserA(String lpszUserName,
    String lpszDomain,
    String lpszPassword,
    int dwLogonType,
    int dwLogonProvider,
    ref IntPtr phToken);
    [DllImport(“advapi32.dll”, CharSet=CharSet.Auto, SetLastError=true)]
    public static extern int DuplicateToken(IntPtr hToken,
    int impersonationLevel,
    ref IntPtr hNewToken);

    [DllImport(“advapi32.dll”, CharSet=CharSet.Auto, SetLastError=true)]
    public static extern bool RevertToSelf();

    [DllImport(“kernel32.dll”, CharSet=CharSet.Auto)]
    public static extern bool CloseHandle(IntPtr handle);

    public void Page_Load(Object s, EventArgs e)
    if(impersonateValidUser(“username”, “domain”, “password”))
    //Insert your code that runs under the security context of a specific user here.
    //Your impersonation failed. Therefore, include a fail-safe mechanism here.

    private bool impersonateValidUser(String userName, String domain, String password)
    WindowsIdentity tempWindowsIdentity;
    IntPtr token = IntPtr.Zero;
    IntPtr tokenDuplicate = IntPtr.Zero;

    if(LogonUserA(userName, domain, password, LOGON32_LOGON_INTERACTIVE,
    LOGON32_PROVIDER_DEFAULT, ref token) != 0)
    if(DuplicateToken(token, 2, ref tokenDuplicate) != 0)
    tempWindowsIdentity = new WindowsIdentity(tokenDuplicate);
    impersonationContext = tempWindowsIdentity.Impersonate();
    if (impersonationContext != null)
    return true;
    if(token!= IntPtr.Zero)
    return false;

    private void undoImpersonation()

    You can even encapsulate that code into your own Impersonation classes rather than using the whole code all the time. These handy functions benefit a lot in other applications too.

    Hope this helps,



  15. sridhar
    May 4, 2007 at 11:16 am

    hi Ayaz,

    I have a problem when connecting to crmservice.

    Here is the sample code

    this code has worked in my local system but when i publish in my webserver it is giving 401 exception i.e,.

    System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
    at net.Crmservice.crm.CrmService.RetrieveMultiple(QueryBase query) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\crm\13032e46\a8bb9262\App_WebReferences.u44or62c.0.cs:line 311

    even i have added

    and i have removed Anonymous access and given windows in iis
    but no use .

    my crmserver is in one location and my webapplication is in another domain

    I have tested in my testserver. it works fine when my testserver contains Vs2005.
    But when i uninstall vs2005 it is giving 401 error.

    // Set up the CRM Service.
    CrmService service = new CrmService();

    service.Url = “http://Crmserver.net/mscrmservices/2006/crmservice.asmx “;
    service.Credentials = CredentialCache.DefaultCredentials;

    //CredentialCache cache = new CredentialCache();

    //string ServiceUserName = ConfigurationSettings.AppSettings[“ServiceUserName”];
    //string ServicePassword = ConfigurationSettings.AppSettings[“ServicePassword”];

    // service.Url = “http://Crmserver/mscrmservices/2006/crmservice.asmx”;

    //service.Credentials = new NetworkCredential(ServiceUserName, ServicePassword, “Crmserver.net”);

    ColumnSet cols = new ColumnSet();

    cols.Attributes = new string[] { “lastname”, “emailaddress1”, “new_password”, “new_companyadmin”, “contactid” };

    QueryExpression query = new QueryExpression();
    query.EntityName = EntityName.contact.ToString();
    query.ColumnSet = cols;

    BusinessEntityCollection contacts;
    contacts = service.RetrieveMultiple(query);

    int res = 0;

    for (int i = 0; i ” + ((contact)(contacts.BusinessEntities[i])).lastname + “ Email Address: ” + ((contact)(contacts.BusinessEntities[i])).emailaddress1 + “ Password: ” + ((contact)( contacts.BusinessEntities[i])).new_password + “” + “ Companyadmin: “);


    Thanks in advance,


  16. Karlo
    May 25, 2007 at 1:09 pm

    An obvious mistake may be that the web service reference is incorrect. For example I have MSCRM installed on my VPC however I want to reference the remote server, thus I update the web reference to point to the new server, specify the remote servers un/pw/domain via NetworkCredentials. I had an issue in that the web references would be updated with my local machine returning error 401. Updating these explicitly to the remote machine solved the issue.

    To avoid DNS issues, use the IP address of the remote server to ensure it works, also try remove the hostname as we’ve found this causes intermittent issues.


  17. Shwetha
    August 22, 2007 at 6:35 am

    Hi All,

    Even i’m facing the same problem. I’m not able to get the solution for this. Can anyone help me in this regard. Actually our product runs on so many production servers and a single customer is experiencing this problem. All others are able to install our product successfully and can access webservices.Only one customer has this problem of not accessing webservices.
    Can anyone suggest the possible solutions for this error.
    Any help will be greatly appreciated.My email id is shwethakailasa@hotmail.com

  18. Averied
    November 7, 2007 at 10:21 am

    Hi.. I get the 401 Unathorized error when i try to view the reports in the Standard CRM installation..

    I’ve tried a lot of things I’ve found, but I can’t access Reports nor System Configuration panel yet..

    Can someone give me more ideas??.. I left a post in CRM newsgroups describing the steps I’ve followed..


  19. Sudhanshu
    November 24, 2007 at 3:14 pm

    hi ayaz,

    i creating account by wepage iam using default credential but i wants to use loogen id user.

  20. jason_w
    January 9, 2008 at 5:56 pm

    An obvious mistake may be that the web service reference is incorrect. For example I have MSCRM installed on my VPC however I want to reference the remote server, thus I update the web reference to point to the new server, specify the remote servers un/pw/domain via NetworkCredentials. I had an issue in that the web references would be updated with my local machine returning error 401. Updating these explicitly to the remote machine solved the issue.

    I had this issue and this is what i came up with.

    The reason for this is the logic in the reference.cs proxy.
    I assume you are explicitly setting the default credentials

    _service.Credentials = System.Net.CredentialCache.DefaultCredentials;
    _service.Url = "http://someurl/crmservice.asmx";

    if you use a local file to add your reference the process hosting the client will think that the url is a “Local” url.

    this is directly from the generated proxy

    public new string Url {
    get {
    return base.Url;
    set {
    if ((((this.IsLocalFileSystemWebService(base.Url) == true)
    && (this.useDefaultCredentialsSetExplicitly == false))
    && (this.IsLocalFileSystemWebService(value) == false))) {
    base.UseDefaultCredentials = false;
    base.Url = value;

    public new bool UseDefaultCredentials {
    get {
    return base.UseDefaultCredentials;
    set {
    base.UseDefaultCredentials = value;
    this.useDefaultCredentialsSetExplicitly = true;

    the if statement in the Url set is the key, it resets the use default credentials to false under certain conditions, which this turns out to be them.

    if the original reference file is a local file and you set default credentials using the WebClient.Credentials property the useDefaultCredentialsSetExplicitly doesn’t get set and the base.UseDefaultCredentials gets set to false if you set the Url to what would now be a non local url.

    The proxy compensates for this with the useDefaultCredentialsSetExplicitly property that does not exist in the base webclient class and the ‘public new bool UseDefaultUrl’, so setting the Credentials explicitly won’t affect the useDefaultCredentialsSetExplicitly property, therefore setting the url after the credentials will remove the credentials (see Url set).

    so 2 options,

    set the credentials after you set the url
    use the UseDefaultCredentials property instead of explicitly assigning them from the System.Net.CredentialCache.DefaultCredentials.

    i don’t know what is up with that logic in the set of the Url in the proxy. It doesn’t seem like these fields need to be intertwined like that, to me it looks like overengineering, but i don’t know the reasons behind it so i cant really say.


  21. Irfan Yar
    March 14, 2008 at 1:36 pm

    please do the following if you still getting the same error

    m_CrmService = new CrmService.CrmService();

    m_CrmService.Credentials = new System.Net.NetworkCredential(“username”, “Password”, “domain”);

    m_CrmService.Url = “service url e.g http://crm/service“;

    CrmService.CrmAuthenticationToken crmServiceToken = new CrmService.CrmAuthenticationToken();

    crmServiceToken.AuthenticationType = Microsoft.Crm.Sdk.AuthenticationType.AD; // or set it to 0

    crmServiceToken.OrganizationName = m_OrganizationName;

    m_CrmService.CrmAuthenticationTokenValue = crmServiceToken;

    m_CrmService.PreAuthenticate = true;

  22. Pramod M
    March 24, 2008 at 11:29 am


    I have installed CRM with IFD enabled. Now if i am accessing any of my custom page i am getting crm login page. If i enter the credential then i am getting the unauthorized error. Detailed error is given below. Can any one help

    WebException: The request failed with HTTP status 401: Unauthorized.]
    System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +533199
    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204
    Microsoft.Crm.Metadata.MetadataWebService.GetDataSet() +31
    Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadDataSetFromWebService(Guid orgId) +300
    Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromWebService(LoadMasks masks, Guid organizationId) +40
    Microsoft.Crm.Metadata.DynamicMetadataCacheFactory.LoadMetadataCache(LoadMethod method, CacheType type, IOrganizationContext context) +418
    Microsoft.Crm.Metadata.MetadataCache.LoadCache(IOrganizationContext context) +292
    Microsoft.Crm.Metadata.MetadataCache.GetInstance(IOrganizationContext context) +286
    Microsoft.Crm.BusinessEntities.BusinessEntityMoniker..ctor(Guid id, String entityName, Guid organizationId) +115
    Microsoft.Crm.Caching.UserDataCacheLoader.LoadCacheData(Guid key, ExecutionContext context) +296
    Microsoft.Crm.Caching.ObjectModelCacheLoader`2.LoadCacheData(TKey key, IOrganizationContext context) +389
    Microsoft.Crm.Caching.BasicCrmCache`2.CreateEntry(TKey key, IOrganizationContext context) +82
    Microsoft.Crm.Caching.BasicCrmCache`2.LookupEntry(TKey key, IOrganizationContext context) +108
    Microsoft.Crm.BusinessEntities.SecurityLibrary.GetUserInfoInternal(WindowsIdentity identity, IOrganizationContext context, UserAuth& userInfo) +313
    Microsoft.Crm.BusinessEntities.SecurityLibrary.GetCallerAndBusinessGuidsFromThread(WindowsIdentity identity, Guid organizationId) +194
    Microsoft.Crm.Authentication.CrmWindowsIdentity..ctor(WindowsIdentity innerIdentity, Boolean publishCrmUser, Guid organizationId) +252
    Microsoft.Crm.Authentication.WindowsAuthenticationProvider.Authenticate(HttpApplication application) +574
    Microsoft.Crm.Authentication.AuthenticationStep.Authenticate(HttpApplication application) +125
    Microsoft.Crm.Authentication.AuthenticationPipeline.Authenticate(HttpApplication application) +66
    Microsoft.Crm.Authentication.AuthenticationEngine.Execute(Object sender, EventArgs e) +475
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

    Pramod M

  23. Amr EL Hariry
    October 2, 2008 at 7:05 pm

    Hi Ayaz;
    good day..
    i installed the crm on a dedicted server @ ISP
    we can acceed the web site thtough the browser easily & we login normally.

    we i tired to install crm for outlook wiht offline access, i choose crm as onliner service provider (as the servers are hosted at data center) when i give the web site , it gives 401 unauthorized, altough we access the site normally through the browser, hope you can help? thanka a lot in advance.

  24. Robbie O
    November 5, 2008 at 11:50 am

    Hiya Ayaz!

    I have alot of CRM users that get this error message:

    ERROR The request failed with HTTP status 401: Unauthorized. account/DD/DD5B4E92-AC91-DB11-A3BF-005056B9399F/Shared Documents/

    Have you seen a similar error or might what it can be?
    is this Blog still in active use?

    I appriciate all the help I can get.

    With the best of regards from Robbie.

  25. Robbie O
    November 5, 2008 at 1:02 pm

    Hi again!

    Just a add to the previous message.
    They get that error message when they try to create new documents.

  26. November 5, 2008 at 8:36 pm

    Please go through all the comments and you can fine my answers to various issue.

    For your issue:

    Please check whether your users have access rights to Document entity. The info you provided seems very strange to me. have you integrated some WSS document managemto CRM.

  27. November 5, 2008 at 8:39 pm

    Hi Pramod M,

    You need to setup your crmservice properly. setting up CRMservice using IFD is given in SDK in detail.

    You need to be very carefull when specifying your URL. I recommend to try that URL first in IE to test whether its a valid URL or not.

  28. Saurabh
    December 1, 2008 at 10:19 am

    Hi Ayaz………….i am creating a Custom SharePoint WebService and create Proxy class by using WSDL command.
    Now i want to access the WebService via Proxy Class it throws this error “The request failed with HTTP status 401: Unauthorized.” i did the impersonate=”true” in web.config and PreAuthenticate=true; also. but it still throws the same error of The request failed with HTTP status 401:UnAuthorized

    can you plz help me out
    Thanx n Regards

  29. Susan
    January 10, 2009 at 5:17 am


    I need to retreive the picklist items values using MetaData service.
    I am not able to connect to the MetaData Service in my production environment which is an IFD deployment.
    It gives me an “401 : UnAuthorised Error.” . The same code works well in my development environment which is a VPC environment.
    Pls find code below for the same.

    Also when I look at the log file the error oroiginates from the line
    “RetrieveAttributeResponse amRes = (RetrieveAttributeResponse)service.Execute(attribReq);”

    The metadata service url created is fine and it returns the meta methods when pasted on a web browser.

    public static MetadataService GetMetaDataService()
    MetadataService service = new MetadataService();
    string organization = “PROD”; //ConfigurationManager.AppSettings[“OrgName”].ToString();
    string server = “PRODUCTION”;//ConfigurationManager.AppSettings[“ServerName”].ToString();
    string domain = “HOSTING”;//ConfigurationManager.AppSettings[“CRMDomain”].ToString();
    string username = “Administrator”;//ConfigurationManager.AppSettings[“CRMUserName”].ToString();
    string password = “XXXXXX”;//ConfigurationManager.AppSettings[“CRMPassword”].ToString();
    string VDBAuthenticationType = “SPLA”;//ConfigurationManager.AppSettings[“AuthenticationType”].ToString();

    service.Credentials = new System.Net.NetworkCredential(username, password,domain);

    string Server = “PRODUCTION”; //ConfigurationManager.AppSettings[“ServerName”].ToString();
    string Port = “80”;//ConfigurationManager.AppSettings[“PortNumber”].ToString();

    service.CrmAuthenticationTokenValue = new MetaSdk.CrmAuthenticationToken();
    service.CrmAuthenticationTokenValue.OrganizationName = organization;

    if (Port != “”)
    service.Url = string.Format(“http://{0}:{1}/mscrmservices/2007/metadataservice.asmx”, Server, Port);
    service.Url = string.Format(“http://{0}/mscrmservices/2007/metadataservice.asmx”, Server);

    catch(SoapException ex)
    ErrorWriter(ex,”Meta Sevice Error”);

    Also the code for Retreiving picklist Values is here
    public static int GetPickListItemValue(string entityName, string pickListName, string itemLabel)

    int itemValue = 0;

    MetadataService service = new MetadataService();

    service = GetMetaDataService();

    RetrieveAttributeRequest attribReq = new RetrieveAttributeRequest();
    attribReq.EntityLogicalName = entityName;
    attribReq.LogicalName = pickListName;

    // Get the attribute metadata for the pickListName attribute.
    RetrieveAttributeResponse amRes = (RetrieveAttributeResponse)service.Execute(attribReq);

    AttributeMetadata am = amRes.AttributeMetadata;

    PicklistAttributeMetadata listData = (PicklistAttributeMetadata)am;

    foreach (Option option in listData.Options)
    foreach (LocLabel label in option.Label.LocLabels)
    // Show US English value:label pairs
    if (label.LanguageCode.Value == 1033)

    if (label.Label.Equals(itemLabel))
    itemValue = option.Value.Value;
    catch(SoapException ex)
    ErrorWriter(ex,”Error in Retreiving PickList Values, Metadata Sevice Error”);

    return itemValue;


    Pls help me out.
    I am stuck with this code as it works fine in mu[y VPC but gives “401 error” in the production.
    Also I have verified that the logged in user has the righta for Entity, Relationship and Attribute as he is the administarator of CRM.

    I have also added tag in the web.confog file but no sucess.


  30. supreeth
    July 17, 2009 at 7:06 am


    I have developed on aspx page in asp.net and deployed inside ISV folder in MS CRM 4.0 in the asp.net page i am trying to create a folder programatically every time it asks me for credentials which is not good ..

  31. July 18, 2009 at 9:58 am

    Please have alook at he rights of the user creating folder. it could be asp.net user or network server user.

  32. michael
    February 25, 2010 at 1:44 pm

    I’ve just had the same error and resolved it by changing the Webservice……

    This isn’t ideal but might point to a better solution.

    In the Config.sys of the Webservice I had this….

    …. which I changed to this……

    …..and now it all works!!!!!

    Obviously this is allowing any user to access the webservice (which might not be ideal) but it might be useful to diagnose the problem.


  33. michael
    February 25, 2010 at 1:47 pm

    hmm… that didn’t work…..try again….


    authentication mode=”Windows” /
    deny users=”?” /
    allow users=”*” /

    …. after……

    authentication mode=”Windows” /
    allow users=”*” /

    …..and now it works!!!!!


  34. March 17, 2010 at 12:22 am

    I like your blog greatly. Will read all. Keep up to briliant writing on it. Gracias

  35. Thiyagarajan.Srinivasan
    April 19, 2010 at 10:09 am

    I struggled to accomplish the 401 error. On studying this blog i just simply followed these steps and it works fine..
    CrmSrv=new CrmService();
    CrmSrv.Url =””;
    CrmSrv.Credentials=new NetworkCredential(“username”,”Password”,”domainname”);
    I set follwing in the web.config

    I just created a contact .

    Thanks for nice blog..

  36. Sumanta
    June 3, 2010 at 10:19 am

    I am getting 401 error while opning a lookup in production env. But the thing is that it is not occuring every time. Specifically when we open the web.config from the publised (deployed) folder and save it without any code modification and trying to reproduce the same , the error disappears. Opening and saving a web.config means resetting the session. Please guide me in this regard.

  1. February 13, 2010 at 3:59 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: