Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

0 views
Skip to first unread message

Xavier Mauclaire

unread,
May 3, 2008, 9:29:08 AM5/3/08
to
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


0 new messages