Solved

VB.Net error: An exception occurred during a WebClient request

Posted on 2017-01-27
6
60 Views
Last Modified: 2017-04-19
Issue:            Trying to download files from a web server.

Problem:      Receive error: An exception occurred during a WebClient request.

Scenario:
I have developed a VB.Net app, which we call MEPIL.  In it, I read an html file that has href references in it to a website where I can download zip files from.  I am not a web or network person so there may be more information to tell you than I am and I just don’t know what it is.

Anyway, this process used to work.  Now it doesn’t.  Now I get the following error:

“An exception occurred during a WebClient request.
Error creating the Web Proxy specified in the ‘system.net/defaultProxy’ configuration settings.”

According to my boss, we don’t use a proxy.

I get this error depending on where I store the VB.Net executable.

If I store the VB.Net executable on our network file server (H:\) drive, then I get this error.  However, if I move the executable to my local PC and run it, it works.  In both instances I execute the executable from my PC (no remoting in to a server or anything).

Note: I have another open question regarding this VB.Net application related to permissions on a SQL Server stored procedure where similar observations are made, except opposite.  With that error, the executable runs successfully if the executable is stored on the H:\drive but it does not run successfully if it is stored my local PC.

Can anyone help me with this?

Thank you.

Tammy
0
Comment
Question by:Tammy Freeman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 20

Accepted Solution

by:
darbid73 earned 500 total points
ID: 41983190
In the absence of some code my guess is that you have a Code Access Security CAS issue.  (Probably the answer to your other question too).  

Here is one link about the problem.

You will find a number of people advocating that running a program from a shared drive is a bad idea.

Next you talk about (H) drives etc.  Please understand that this letter H is just something windows does to make it easier for users.  When programing you are going to have to use the UNC path.  This is "\\ComputerName\SharedFolder\Resource"  See Universal Naming Convention.
0
 

Author Comment

by:Tammy Freeman
ID: 41985559
darbid73 -

Thank you for your response.  A couple of things:

1.  Yes, I know H drive is just a letter, but it is easier than giving the URL and, even though you don't know what company I work for or anything, I don't want to give out any more information than I have to so that I am not causing a security issue of any sort.

2.  I think your CAS reasoning makes sense.  I am just not sure how to solve it.  I found the following web page: http://www.codemag.com/article/0405031 but I can't find the .NET Framework 1.1 Configuration tool on my PC.  It is not in the Control Panel that I can find.  So, I can't see what the rights are, much less figure out how to work with them.

3.  The line of code that I am using that is failing is:

   My.Computer.Network.DownloadFile(strHREFParse, My.Settings.DownloadPath & "\" & strDownloadFile, strID, strPwd, False, 4000000, True)

Here is an example of the href command with identifying information stripped out:

            <dd><a href="https://www###.xxxxx.co.xxx/xxx/global/xxxxx/ssl/xxx/databook/00_data.zip" target="_blank">0.TSV DATA</a></dd>

I pull out the "https://www###.xxxxx.co.xxx/xxx/global/xxxxx/ssl/xxx/databook/00_data.zip" from it.

So, I think you have sent me in the right direction but I don't yet have a solution.  Any additional help you can give me would be appreciated.  If I need to provide any additional information, just ask.

Thank you.

Tammy
0
 
LVL 20

Assisted Solution

by:darbid73
darbid73 earned 500 total points
ID: 41988473
Hi Tammy,

using your numbering;

1. That is ok, but you need to talk in UNCs and not drive letters. Also see later as I think you still "shaky" on this point.
2.  I have to admit that if I had this problem I would have to do just as much research as you. In other words I am not an expert.  see here for getting the tool.
3. You say that it works on your local PC but not on a server PC -  both " My.Computer.Network" and "My.Settings.DownloadPath " will both be different in this case and I suspect the reason for the failure.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:Tammy Freeman
ID: 41996304
Thank you for your help again Darbid73.  

You got me moving in the right direction.  I still don't have a solution, but I am looking into it.  I may not try to resolve this issue.  I may try to resolve my other issue.  I would rather run the app from a localhost/PC rather than the network anyway and this is the issue that fails on the network.

By the way, I do know the difference between drive letters and UNC.  As I said, in my question I was using a drive letter to represent the UNC so I didn't put a UNC out publicly, even if it is within our firewall.  In my code, however, I do use the UNC.  So, it isn't a UNC problem.  I understand why you thought it may be so I am not saying this as a negative on your comment.  Just letting you know.

I will close this and give credit when I resolve the issue.

I appreciate your help.

Thank you.

Tammy
0
 

Author Comment

by:Tammy Freeman
ID: 42099040
I hated to mark my comment as the best solution, but it explains what I did.  If I marked something else that didn't work someone would think it did work.
0
 

Author Closing Comment

by:Tammy Freeman
ID: 42099055
The reason I selected darbid as the best solution is because he advocated not running the app from a shared drive.  That is the route I went down.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question