UpdatePanel 内でカスタム テキスト キャプチャを使用しようとしています。localhost では正常に動作しますが、Web サーバーにデプロイすると表示されません。私はVS 2010を使用しています-コードにはvb.net、asp.net 4.0とIIS 6.0はWebサーバーにあります。これが私のコードです:
Private Function GenerateRandomCode() As String
'Generate a random number for the CAPTCHA image
Dim s As String = ""
For i As Integer = 0 To 5
s = s + Me.rand.Next(10).ToString()
Next
Return s
End Function
Public Sub SetCaptcha()
'Create a new captcha image
Me.Session("CaptchaImageText") = GenerateRandomCode()
'append current date to image url to assure loading of new image
Me.lblResult.ImageUrl = "GetImage.aspx?" + DateTime.Now.ToString()
End Sub
Partial Class GetImage
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Cache.SetCacheability(HttpCacheability.NoCache)
'Create a CAPTCHA image using the text stored in the Session object.
Dim ci As New CaptchaImage.CaptchaImage(Me.Session("CaptchaImageText"), 200, 50, "Century Schoolbook")
Me.Response.Clear()
Me.Response.ContentType = "image/png"
ci.Image.Save(Me.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
ci.Dispose()
End Sub
End Class
enter code here