for captcha i used the following code

Aug 25 2012 8:30 AM
when project run on local machine no error. but when i upload project it show that error described on subject textbox. i hav used following code:

any one solve this as early as possible.................................

Function fncDrawCaptcha(ByVal path As String) As String

        '*** Editable Values
        Dim BackgroundColor As [String]() = New [String]() {255, 255, 255} ' The 3 numbers represent in order RED, GREEN, BLUE for the captcha's background color
        Dim RandomBackgroundNoiseColor As Boolean = True ' True / False. If you choose True, BackgroundNoiseColor will not apply
        Dim RandomTextColor As Boolean = False ' True / False. If you choose True, TextColor will not apply
        Dim BackgroundNoiseColor As [String]() = New [String]() {150, 150, 150} ' The 3 numbers represent in order RED, GREEN, BLUE
        Dim TextColor As [String]() = New [String]() {25, 60, 175} ' The 3 numbers represent in order RED, GREEN, BLUE
        Dim BackgroundNoiseTexture As HatchStyle = HatchStyle.Min ' replace ".Min" with any of the following: Horizontal, Vertical, ForwardDiagonal, BackwardDiagonal, Cross, DiagonalCross, Percent05, Percent10, Percent20, Percent25, Percent30, Percent40, Percent50, Percent60, Percent70, Percent75, Percent80, Percent90, LightDownwardDiagonal, LightUpwardDiagonal, DarkDownwardDiagonal, DarkUpwardDiagonal, WideDownwardDiagonal, WideUpwardDiagonal, LightVertical, LightHorizontal, NarrowVertical, NarrowHorizontal, DarkVertical, DarkHorizontal, DashedDownwardDiagonal, DashedUpwardDiagonal, DashedHorizontal, DashedVertical, SmallConfetti, LargeConfetti, ZigZag, Wave, DiagonalBrick, HorizontalBrick, Weave, Plaid, Divot, DottedGrid, DottedDiamond, Shingle, Trellis, Sphere, SmallGrid, SmallCheckerBoard, LargeCheckerBoard, OutlinedDiamond, SolidDiamond, LargeGrid, Min, Max
        Dim length As Integer = 6 ' Number of characters to generate
        '*** END Editable Values

        Dim height As Integer = 100
        Dim width As Integer = 200
        width = width + ((length - 6) * 30)
        Dim ranRotate As New Random
        Dim strText As String = left(replace(System.Guid.NewGuid().ToString(), "-", ""), length)
        Dim bmpCanvas As New Bitmap(width, height, PixelFormat.Format24bppRgb)
        Dim graCanvas As Graphics = Graphics.FromImage(bmpCanvas)
        Dim recF As New RectangleF(0, 0, width, height)
        Dim bruBackground As Brush
        Dim letterBrush As SolidBrush

        'graCanvas.TextRenderingHint = TextRenderingHint.AntiAlias

        If RandomBackgroundNoiseColor = True Then
            bruBackground = New HatchBrush(BackgroundNoiseTexture, Color.FromArgb((ranRotate.Next(0, 255)), (ranRotate.Next(0, 255)), (ranRotate.Next(0, 255))), Color.FromArgb(BackgroundColor(0), BackgroundColor(1), BackgroundColor(2)))
        Else
            bruBackground = New HatchBrush(BackgroundNoiseTexture, Color.FromArgb(BackgroundNoiseColor(0), BackgroundNoiseColor(1), BackgroundNoiseColor(2)), Color.FromArgb(BackgroundColor(0), BackgroundColor(1), BackgroundColor(2)))
        End If

        graCanvas.FillRectangle(bruBackground, recF)

        If RandomTextColor = True Then
            letterBrush = New SolidBrush(Color.FromArgb((ranRotate.Next(0, 255)), (ranRotate.Next(0, 255)), (ranRotate.Next(0, 255))))
        Else
            letterBrush = New SolidBrush(Color.FromArgb(TextColor(0), TextColor(1), TextColor(2)))
        End If

        Dim matRotate As New System.Drawing.Drawing2D.Matrix
        Dim i As Integer
        For i = 0 To Len(strText) - 1
            matRotate.Reset()
            matRotate.RotateAt(ranRotate.Next(-30, 30), New PointF(width / (Len(strText) + 1) * i, height * 0.5))
            graCanvas.Transform = matRotate
            If i = 0 Then
                graCanvas.DrawString(strText.Chars(i), New Font("Verdana", 25, FontStyle.Regular), letterBrush, width / (Len(strText) + 1) * i, height * 0.4) 'draw 'the text on our image
            ElseIf i = 1 Then
                graCanvas.DrawString(strText.Chars(i), New Font("Verdana", 30, FontStyle.Regular), letterBrush, width / (Len(strText) + 1) * i, height * 0.1) 'draw 'the text on our image
            ElseIf i = 2 Then
                graCanvas.DrawString(strText.Chars(i), New Font("Verdana", 25, FontStyle.Regular), letterBrush, width / (Len(strText) + 1) * i, height * 0.5) 'draw 'the text on our image
            ElseIf i = 3 Then
                graCanvas.DrawString(strText.Chars(i), New Font("Verdana", 35, FontStyle.Regular), letterBrush, width / (Len(strText) + 1) * i, height * 0.1) 'draw 'the text on our image
            ElseIf i = 4 Then
                graCanvas.DrawString(strText.Chars(i), New Font("Verdana", 25, FontStyle.Regular), letterBrush, width / (Len(strText) + 1) * i, height * 0.5) 'draw 'the text on our image
            ElseIf i = 5 Then
                graCanvas.DrawString(strText.Chars(i), New Font("Verdana", 30, FontStyle.Regular), letterBrush, width / (Len(strText) + 1) * i, height * 0.1) 'draw 'the text on our image
            Else
                graCanvas.DrawString(strText.Chars(i), New Font("Verdana", 30, FontStyle.Regular), letterBrush, width / Len(strText) * i, height * 0.5) 'draw 'the text on our image
            End If
            graCanvas.ResetTransform()
        Next

        bmpCanvas.Save(path, ImageFormat.Gif)
        graCanvas.Dispose()
        bmpCanvas.Dispose()
        Return strText
    End Function

Answers (2)