Pb with Webclient object since Framework 3.0 installed. need help !!

  • Thread starter Xavier Mauclaire
  • Start date
X

Xavier Mauclaire

Hi

I've got a piece of code using the webclient object (see below). This
function was working until i installed the . Net 3.0 on my computer. This
code run withs the version 2.0 of the dotnet Framework.

After this installation, the OpenRead functiuon generate an error. "Can't
open a session, wring username or password". Or Creadentials informations
are good.

This code will works if i connect to the shared network with the explorer
before using it. I don't understand !!

The shared folder is located on a linux server.

Thanks in advance


private Boolean IsFileRef_old(Int64 lid) {

Boolean bres = true;

String zCheminPdf =
System.Configuration.ConfigurationSettings.AppSettings["CheminDocumentshttp"].ToString();

String zUserName =
System.Configuration.ConfigurationSettings.AppSettings["DefaultUserDocuments"].ToString();

String zUserPwd =
System.Configuration.ConfigurationSettings.AppSettings["DefaultUserPwdDocuments"].ToString();

String zFileName = zCheminPdf + lid.ToString() + ".pdf";

WebClient request = new System.Net.WebClient();

// This example assumes the FTP site uses anonymous logon.

NetworkCredential pCredentials = new
System.Net.NetworkCredential(zUserName,zUserPwd);


request.Credentials = pCredentials;

try {

Stream pStream = request.OpenRead(zFileName);

pStream.Close();

pStream.Dispose();

pStream = null;

} catch(Exception pEx) {

bres = false;

//throw pEx;

} // end try catch

request.Dispose();

request = null;



return bres;

} // end function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top