473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Trying to impersonate

I'm trying to impersonate a admin user when retrieving picklist items in
Microsoft CRM. When
a windows 2000 user is opening the code it is getting a popup asking the
username, password, and domain.

Can someone please help??

The coce i am using is this,

System.Net.CredentialCache MyCredentials = new System.Net.CredentialCache();

System.Net.NetworkCredential MyNetCred =

new System.Net.NetworkCredential(@"user",@"password",@ "CRM");

MyCredentials.Add

(new Uri(strDir + "BizUser.srf"), "NTLM", MyNetCred);

MyCredentials.Add

(new Uri(strDir + "CRMCustomization.srf"), "NTLM", MyNetCred);

MyCredentials.Add

(new Uri(strDir + "CRMContact.srf"), "NTLM", MyNetCred);

MyCredentials.Add

(new Uri(strDir + "CRMQuery.srf"), "NTLM", MyNetCred);

//BizUser object

bizUser = new Microsoft.Crm.Platform.Proxy.BizUser();

bizUser.Credentials = MyCredentials;

bizUser.Url = strDir + "BizUser.srf";

// CRMCustomization proxy object

Microsoft.Crm.Platform.Proxy.CRMCustomization customization = new
Microsoft.Crm.Platform.Proxy.CRMCustomization();

customization.Credentials = MyCredentials;

customization.Url = String.Concat(strDir, "CRMCustomization.srf");

//create CRM Contact proxy object

Microsoft.Crm.Platform.Proxy.CRMContact contact = new
Microsoft.Crm.Platform.Proxy.CRMContact();

contact.Credentials = MyCredentials;

contact.Url = String.Concat(strDir, "CRMContact.srf");
//create CRM Account proxy object

Microsoft.Crm.Platform.Proxy.CRMAccount account = new
Microsoft.Crm.Platform.Proxy.CRMAccount();

account.Credentials = System.Net.CredentialCache.DefaultCredentials;

account.Url = String.Concat(strDir, "CRMAccount.srf");
// Query proxy object

Microsoft.Crm.Platform.Proxy.CRMQuery query = new
Microsoft.Crm.Platform.Proxy.CRMQuery ();

query.Credentials = MyCredentials;

query.Url = strDir + "CRMQuery.srf";
try

{

Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

userAuth = this.bizUser.WhoAmI();

}
Dec 22 '05 #1
0 1506

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ian | last post by:
The beginning of my assembly that I am getting the access error from looks like this. ********************************* Imports System.EnterpriseServices Imports System Imports...
1
by: moemeelaung | last post by:
Hi ASP/Windows experts out there I really need help with this Impersonate function. I have machine A and B. A hosts my ASP page which is to create a user account on the machine B. The...
5
by: paulp | last post by:
Greetings, I'm working on a CGI program that will run under MS IIS 5.0 and will browse folders on three other machines, building HTML pages that will provide links to these folders. ...
14
by: Ian Frawley | last post by:
Anyone used the WindowsIdentity class with success? I find if I try to change the current identity to one that exists on another machine and then try to perform and action on that machine i.e....
6
by: Erez Shor | last post by:
Hi, I need to build and asp page which access a remote windows server's registry and create a registry key. In order for the ASP page to be able to access the registry on the remote server I need...
1
by: Svein Terje Gaup | last post by:
I have a website running on Windows 2000 Server, that should be able to retrieve data from a datawarehouse on another machine running Windows 2000 Server, SQL Server 2000 and SQL Server 2000...
2
by: rockdale | last post by:
Hi, all: My asp.net application calles MS speech 5.1 and generate a wav file on server's path. Everything runs perfectly on my development machine. But when I move the appl to production server,...
4
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this...
2
by: =?Utf-8?B?bXVyYWRqYW1lcw==?= | last post by:
Yes, sorry I tried to make it clear in the original question that I want to get the user token of the service - ie. the account the service is running under. I know services don't have user tokens...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.