Archive for October, 2007

Extracting ViewState and other ASP .Net params

This is a very simple function for extracting any ASP .Net page state value such as __VIEWSTATE or __EVENTVALIDATION. These values are necessary when scraping some websites.

  1. Public Shared Function ExtractDotNetData(ByVal strData As String, ByVal strStateName As String, ByVal strDelimiter As String) As String
  2.  
  3. Dim iStateNamePosition As Integer = strData.IndexOf(strStateName)
  4. If iStateNamePosition < 0 Then Return ""
  5.  
  6. Dim iStateValuePosition As Integer = strData.IndexOf(strDelimiter, iStateNamePosition)
  7. If iStateValuePosition < 0 Then Return ""
  8.  
  9. Dim iStateStartPosition As Integer = iStateValuePosition + strDelimiter.Length
  10. Dim iStateEndPosition As Integer = strData.IndexOf("""", iStateStartPosition)
  11.  
  12. Return HttpUtility.UrlEncodeUnicode(strData.Substring(iStateStartPosition, iStateEndPosition - iStateStartPosition))
  13. End Function
  14.  
  15. strViewState = ExtractDotNetData(strResponseData, "__VIEWSTATE", "value=""")
  16. strEventValidation = ExtractDotNetData(strResponseData, "__EVENTVALIDATION", "value=""")

Ash & Bone

This was the first John Harvey book that I read. Since I pulled it off the shelf at random, I noticed it had a positive blurb from Elmore Leonard. I have had problems connecting with other British writers, so I was a bit leery. Overall, I liked his writing style, though some of the back story seemed a bit too in depth. Looking forward to reading more by this author.

Ash & Bone (Frank Elder Mysteries)

Death Bed

Not bad. I found the ending to be a bit weak, but that is often times the case in the detective genre.

Death bed: A detective story

Tigers in Combat, Vol. 1

Meticulous detail of tank numbering and unit histories. The photographs are what make this book unique. The title is a bit misleading as the vast majority of the photos are not combat related. However, this is nitpicking. Maintenance and recovery photos seem to be from personal collections rather than stock photos.

Tigers in Combat, Vol. 1

The Bielski Brothers

Pretty amazing book about survival of Jewish refugees and partisans in the swamps and forests in Belarus during WWII. Details conflicts and suspicions that arose between the different partisan groups, all of whom were under the suspicion of the Soviet Union.

The Bielski Brothers : The True Story of Three Men Who Defied the Nazis, Built a Village in the Forest, and Saved 1,200 Jews

A sad end for one of the Bielski brothers:

Holocaust hero accused of swindling

File permission error in .Net 2.0

If you are moving a .Net 1.1 app to a server with 2.0, you may need to add the param

<trust level="Full" originUrl="" />

to your web.config if you are doing any sort of file upload.

There may be a more elegant way, but this was the quickest resolution I could find.