我正在尝试在 UpdatePanel 中使用自定义文本验证码。它在本地主机上运行良好,但是当我将它部署到网络服务器时它没有显示。我正在使用 VS 2010 - vb.net 代码和 asp.net 4.0 和 IIS 6.0 在网络服务器上。这是我的代码:
   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