Thought this could be useful in near future, reposting this for my own reference:
‘ calculate the MD5 hash of a given string
‘ the string is first converted to a byte array
Public Function MD5CalcString(ByVal strData As String) As String
Dim objMD5 As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim arrData() As Byte
Dim arrHash() As Byte
‘ first convert the string to bytes (using UTF8 encoding for unicode characters)
arrData = System.Text.Encoding.UTF8.GetBytes(strData)
‘ hash contents of this byte array
arrHash = objMD5.ComputeHash(arrData)
‘ thanks objects
objMD5 = Nothing
‘ return formatted hash
Return ByteArrayToString(arrHash)
End Function
‘ utility function to convert a byte array into a hex string
Private Function ByteArrayToString(ByVal arrInput() As Byte) As String
Dim strOutput As New System.Text.StringBuilder(arrInput.Length)
For i As Integer = 0 To arrInput.Length – 1
strOutput.Append(arrInput(i).ToString(“X2″))
Next
Return strOutput.ToString().ToLower
End Function
Written by admin on January 5th, 2012 with no comments.
Read more articles on Personal and Programming and Web.
It was a normal weekday and I was just wanted to start my development work. While I was trying to run a web application, this abnormal behavior crops up. It was still working fine the day before and nothing changed since then. What could possibly went wrong? Looking through the event viewer, manage to find this error:
Event code: 3008
Event message: A configuration error has occurred.
Process information:
Process ID: 5080
Process name: WebDev.WebServer.exe
Exception information:
Exception type: HttpException
Exception message: Could not load file or assembly ‘LibraryName, Version=1.0.2209.32145, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0×80131418)
That’s probably what could be helpful that indicates the problem. But there isn’t anything changed prior to this, my pc was left into standby mode, I can’t think of any possible reason behind. Looking further on the error message that appears on the browser in attempt to load the web:
Exception: System.Web.HttpException
Message: Could not load file or assembly ‘LibraryName, Version=1.0.2209.32145, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0×80131418)
Started to get me thinking if there is any permission need to be set on the temporary directory which I did without hesitance. But that didnt get me elsewhere, not even any further clues. Then that reminds me of trying to move the web apps. folder to “C:” drive (the main partition in which the windows are situated as well), for a try. Viola, it resolves. I guess the security has gone haywire but what I still can’t figure out is, why of all sudden the issue arise?
If only I can debug Windows.
Written by admin on September 8th, 2011 with no comments.
Read more articles on Personal and Programming.