I am attempting to download GitHub Enterprise's all_users.csv file via vb.net using .net framework 4.5.2 and get the following error: The remote server returned an error: (404) Not Found.
My code is:
Module Module1
Sub Main()
Dim remoteUri As String = "https://ghe.webserver/stafftools/reports/all_users.csv"
Dim fileName As String = "all_users.csv"
Dim password As String = "PERSONALACCESSTOKEN"
Dim username As String = "USERNAME"
System.Net.ServicePointManager.Expect100Continue = True
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
Dim client As New System.Net.WebClient
client.Credentials = New System.Net.NetworkCredential(username, password)
client.DownloadFile(remoteUri, fileName)
End Sub
End Module
The error occurs at the line client.DownloadFile(remoteUri, fileName)
with the full exception
System.Net.WebException was unhandled
HResult=-2146233079
Message=The remote server returned an error: (404) Not Found.
Source=System
StackTrace:
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at ConsoleApplication1.Module1.Main() in C:\Users\Admin\AppData\Local\Temporary Projects\ConsoleApplication1\Module1.vb:line 13
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
The following Curl command however works (as described here:https://help.github.com/en/enterprise/2.17/admin/installation/site-admin-dashboard#reports):
curl -L -u USERNAME:PERSONALACCESSTOKEN --insecure https://ghe.webserver/stafftools/reports/all_users.csv