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

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
Tammy FreemanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

darbid73Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tammy FreemanAuthor Commented:
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
darbid73Commented:
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
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tammy FreemanAuthor Commented:
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
Tammy FreemanAuthor Commented:
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
Tammy FreemanAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.