[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

NTLM Authentication .net cf 1.0

Hi,

I'm using .net cf 1.0 for transferring the xml file to the SharePoint site. The site requires NTLM authentication. Below written code does not work for the NTML authenticated sites, else works fine. Code snippet is as below:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();
credential = new NetworkCredential(userName, password);

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(remoteFileURL);
Stream stream = null;
HttpWebResponse response = null;

FileStream file = new FileStream(localFileURL, System.IO.FileMode.Open);                  
request.Method = "PUT";
request.Credentials = credential;
request.PreAuthenticate = true;
request.AllowWriteStreamBuffering = true;
request.SendChunked = true;
request.ContentLength = file.Length;      
request.KeepAlive = true;
                        
stream = request.GetRequestStream();
byte[] buffer = new byte[512];
int len = 0;

while((len = file.Read(buffer, 0, buffer.Length)) > 0 )
{            
        stream.Write(buffer, 0, len);
}
stream.Flush();
stream.Close();      
file.Close();
      
response = (HttpWebResponse)request.GetResponse();
response.Close();

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

It returns internal server error 500. .net cf 1.0 does not support CredentialCache :(

Is there any work around to copy the file to the desired url?

Thanks,
FTSS
0
ftss
Asked:
ftss
1 Solution
 
umaheshCommented:
Do you have both the devices on same or trusted domain.

Because, on the desktop, NTLM uses authentication information established when the user logs on. It requires the client and server to be on the same or trusted domains.

Since Windows CE does not allow a user to log in, it pops up a dialog box to extract the authentication information when NTLM authentication is required.

Read here for more details
https://thesource.ofallevil.com/technet/prodtechnol/wce/evaluate/multice.mspx

Goodluck
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now