|
-
Dec 23rd, 2005, 02:24 PM
#1
Thread Starter
Lively Member
help with System.Net
Code:
Dim key As Microsoft.Win32.RegistryKey
key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
Dim Proxy As String = CType(key.GetValue("ProxyServer"), String)
Dim Enable As String = CType(key.GetValue("ProxyEnable"), String)
If Enable = 1 Then
'Gets Time
Dim StartTime As Decimal
StartTime = TimeOfDay.Minute & "." & TimeOfDay.Second
Dim wc As New System.Net.WebClient()
Dim wp As New System.Net.WebProxy(Proxy)
wc.DownloadFile("http://www.online-solutions.org/flash/player/flashplayer7_netscape.exe", _
"C:\flashplayer7_netscape.exe")
'Gets time
Dim EndTime As Decimal
EndTime = TimeOfDay.Minute & "." & TimeOfDay.Second
''Deletes the file
'filesys.DeleteFile("c:\newf1.zip")
Dim TimeIt As Integer
If EndTime - StartTime = 0 Then
MessageBox.Show("Error")
End
Else
'Calculates the download rate and stores it in a variable
TimeIt = 668 / (EndTime - StartTime)
End If
End If
This is the code that I have I need to be able to put the proxy that is detected into the download string. I left out the Else statement because it doesnt matter but if someone can help I would be greatful.
Thanks
"A candle loses nothing by lighting another candle."
-
Dec 23rd, 2005, 02:47 PM
#2
-
Dec 23rd, 2005, 03:35 PM
#3
Thread Starter
Lively Member
Re: help with System.Net
I need to set the proxy so that the file will download. I have already got the proxy setings and put it in proxy variable.
"A candle loses nothing by lighting another candle."
-
Dec 23rd, 2005, 04:40 PM
#4
Re: help with System.Net
Try this code, I didn't actually have a proxy server set up to test, but I was able to still download it when it didn't find a proxy server...
VB Code:
Dim key As Microsoft.Win32.RegistryKey
key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
Dim Proxy As String = CType(key.GetValue("ProxyServer"), String)
Dim Enable As String = CType(key.GetValue("ProxyEnable"), String)
MsgBox(Enable)
Dim wc As New System.Net.WebClient
Dim wp As New System.Net.WebProxy(Proxy)
wc.DownloadFile((wp.GetProxy(New System.Uri( _
"http://www.online-solutions.org/flash/player/flashplayer7_netscape.exe")).ToString), _
"C:\flashplayer7_netscape.exe")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|