473,941 Members | 35,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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(I nt64 lid) {

Boolean bres = true;

String zCheminPdf =
System.Configur ation.Configura tionSettings.Ap pSettings["CheminDocument shttp"].ToString();

String zUserName =
System.Configur ation.Configura tionSettings.Ap pSettings["DefaultUserDoc uments"].ToString();

String zUserPwd =
System.Configur ation.Configura tionSettings.Ap pSettings["DefaultUserPwd Documents"].ToString();

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

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

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

NetworkCredenti al pCredentials = new
System.Net.Netw orkCredential(z UserName,zUserP wd);
request.Credent ials = pCredentials;

try {

Stream pStream = request.OpenRea d(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
Jun 27 '08 #1
0 891

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

Similar topics

5
6240
by: Seymen Ertas | last post by:
Hi, I don't know if this is the correct place to post this but i am having a little problem with the OpenRead function of the WebClient. Below is the code i am trying to get it to work: WebClient Client = new WebClient(); Stream strm = Client.OpenRead("http://something.jsp?user=username");
5
1484
by: Michal Rizek | last post by:
Hi, i need to use COM object in my application running on Pocket PC 2003. I used tlbimp utility to create clr assembly and added it into my project. But when i try to create instance of COM object BALSYSLib.BalSystemClass sys = new BALSYSLib.BalSystemClass(); InvalidOperationException is thrown. It is even thrown earlier then the program reaches that line - propably JIT compiler throws it (it is thrown while entering procedure...
6
13327
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileID.ToString() + ".pdf");
1
2985
by: Adnan Selimovic | last post by:
Hi folks! I tried to post a web form using the WebClient class and HttpWebRequest/HttpWebResponse. It didn't work for the ASPX web pages. I always got an unposted version - like if I had just made a simple request without posting anything. I have written the same thing using the Perl's LWD::UserAgent class and it was the same. The web form is really very simple. As soon as I created the ASP file with the same form everything worked! Does...
3
7599
by: Manuel | last post by:
I have an asp page ("test.asp") that presents the data it receives from a post.When I try the following code, test.asp doesn't return the values (supposedly) posted to it. If I make a web page with a form and the values, test.asp reports them fine. ---------------------------- Dim thePost As String = "Variable1=Value1&Variable2=Value2&Variable3=Value3" Dim thePage As Byte() Dim MyWebClient As New System.Net.WebClient
6
22128
by: Giovanni | last post by:
Hi Guys, Really strange problem I am experiencing... I have setup a virtual directory with Read Only permissions on an ISA/IIS server (SBS 2003). In that virt. dir., I placed 1 file (setup.exe). I then use WebClient.DownloadFileAsync (.NET 2.0 Pro.) and all downloads well including progress bar indicator, bytes received, etc... Here is the problem: When I replace the file (setup.exe), with a different, larger file, it still...
4
7791
by: Lehel Kovach | last post by:
I'm having a problem with the WebClient object. When I post data to certain sites, it will receive a command from the webserver (object moved) and continue to the next link by downloading that. The problem is, certain cookies need to be set, and the only way of doing that is not letting the WebClient automatically go on to the next GET in the background--I need to do it manually. I'm wondering if this has something to do with the...
42
510
by: dancer | last post by:
Using VB.net and ASP.net At runtime I receive the error that MANY people receive who are using much more complicated code than mine. "Object reference not set to an instance of an object. " I know WHY it's happening. It is when a selection is not made to a RadioButtonList, so the item is = to nothing.
0
2867
by: malkin | last post by:
Hi all, I have an external application that calls WebClient to download a file from our server. It runs fine without any proxy server involved. However, once there is a proxy server layer, it throws a 407 proxy authentication required error. My question is that since I do not know whether the users are going to download a file thru a proxy, is there a way in C# to specify a general way of coding to handle proxy and non-proxy users? ...
0
10134
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11113
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9858
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6080
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6298
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4450
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.