2017-08-28 6 views
0

で発生した、完全な例外は、次のようになります。System.Net.WebExceptionが」System.dllの

Public Function GetHash(password As String) As String Implements IHashManager.GetHash 
     Dim uRL As String = HttpContext.Current.Request.Url.Scheme & "://" & HttpContext.Current.Request.Url.Host & ":" & HttpContext.Current.Request.Url.Port & "/md5_hash.asp?val=" & password 

     ' Dim myWebClient As New Net.WebClient 
     Using myWebClient As New Net.WebClient 
      Return myWebClient.DownloadString(uRL) 
     End Using 
    End Function 

それは、リターンライン上の例外がスローされます。

An exception of type 'System.Net.WebException' occurred in System.dll but was not handled in user code 

Additional information: The remote server returned an error: (404) Not Found. 

私のコードは次のようになります。

コードの目的は、現在のURLを使用して、パスワードのハッシュを返すことです。私はこのコードを書いていないし、なぜそれがエラーなのか分からない。なぜ誰が知っていますか?

答えて

0

あなたはmyWebClient.DownloadString()を呼び出すときにuRLの値が何であるかをチェックする必要があります。 「追加情報」は非常に明確です。 uRLで特定されたリソースが見つかりません/その場所に存在しないことを示す404エラーが表示されます。

+1

また、わからないコードを使用しないでください。 –

+0

ご回答いただきありがとうございます。この質問の目的は、コードをよりよく理解し、問題を解決することでした。私は理解していないコードを使用しないようにしています – Andrew

関連する問題