default.aspx.vb:
Partial Class _Default
Inherits System.Web.UI.Page
Dim siteUrl As String
Dim screenWidth As Integer
Dim screenHeight As Integer
Dim imageWidth As Integer
Dim imageHeight As Integer
Dim nextUrl As String
Dim snapshotFile As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
siteUrl = Request("siteurl")
screenWidth = Integer.Parse(Request("screenw"))
screenHeight = Integer.Parse(Request("screenh"))
imageWidth = Integer.Parse(Request("imagew"))
imageHeight = Integer.Parse(Request("imageh"))
nextUrl = Request("nexturl")
snapshotFile = Request("snapshotfile")
Dim NewTh As New Threading.Thread(AddressOf DoIT)
NewTh.SetApartmentState(Threading.ApartmentState.STA)
NewTh.Start()
While NewTh.ThreadState = Threading.ThreadState.Running
End While
If Not nextUrl = Nothing Then
If nextUrl.Length > 0 Then
Response.Redirect(nextUrl)
End If
End If
End Sub
Sub DoIT()
Try
Dim thumb As New GetSiteThumbnail.GetImage("
http://" & siteUrl, screenWidth, screenHeight, imageWidth, imageHeight)
Dim x As System.Drawing.Bitmap = thumb.GetBitmap()
x.Save(Server.MapPath(".") & "\" & snapshotFile)
Catch ex As Exception
Dim y As System.IO.StreamWriter = System.IO.File.CreateText(Server.MapPath(".") & "\error.txt")
y.WriteLine(ex.Message & vbCrLf & ex.Source)
y.Flush()
y.Close()
Finally
End Try
End Sub
End Class