【发布时间】:2012-02-14 06:56:15
【问题描述】:
我在修改一个用 VB.NET 编写的现有网站时遇到了很多麻烦。
有人可以向我解释一下 VB.NET-chrome 关系的基础知识吗?
我遇到的具体问题是通过网站发送邮件,我添加相关代码没有问题,我只是觉得在开始寻找错误之前我需要了解更多。
在网站中,有一个选项可以向人员列表发送电子邮件。此选项在 IE 中有效,但在 firefox 和 chrome 中无效。我基本上有一个表单标签,其中包含一个包含人员列表的表格,每个名字旁边都有一个复选按钮。当你点击发送时,有一个这样定义的函数
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sTo As String, sFrom As String, sSubject As String, sBody As String
Dim sCc As String, sBcc As String
Dim MyMail As MailMessage = New MailMessage
sFrom = "Laboratory Mail system sent from " & Session.Contents("UserNameEng") & " <dbsystem@mscc.huji.ac.il>"
sTo = Trim(Request.Form("EmailTo")) & txtTo.Text
sCc = Trim(Request.Form("EmailCc")) & txtCc.Text
sSubject = Trim(txtSubject.Text)
sBody = Trim(txtBody.Text)
sBody = sBody.Replace(vbCrLf, "<br />") 'new
MyMail.Headers.Add("Reply-To", Session.Contents("UserEmail"))
MyMail.From = sFrom
MyMail.To = sTo
MyMail.Subject = sSubject
MyMail.BodyFormat = MailFormat.Html 'new
'MyMail.Body = sBody
Select Case optDirection.SelectedValue.ToString
Case "BodyRtl"
MyMail.Body = "<style> body {direction: rtl} </style>" & sBody
Case "BodyLtr"
MyMail.Body = "<style> body {direction: ltr} </style>" & sBody
End Select
' MyMail.Body = "<style> body {direction: rtl} </style>" & sBody 'new
' MyMail.BodyEncoding = System.Text.Encoding.GetEncoding("iso-8859-8-i")
MyMail.Cc = sCc
If chkCopyForMe.Checked Then
MyMail.Bcc = Session.Contents("UserEmail")
End If
'MyMail.BodyFormat = MailFormat.Text
Select Case optPriority.SelectedValue.ToString
Case "Normal"
MyMail.Priority = MailPriority.Normal
Case "High"
MyMail.Priority = MailPriority.High
Case "Low"
MyMail.Priority = MailPriority.Low
End Select
If Trim(UploadFile.Value) <> vbNullString Then
Dim myAttachment As New MailAttachment(GetAttachment(Trim(UploadFile.Value))) '(Trim(UploadFile.Value))
MyMail.Attachments.Add(myAttachment)
End If
SmtpMail.SmtpServer = "pluto.mscc.huji.ac.il"
Try
SmtpMail.Send(MyMail)
Response.Redirect("SentMessage.aspx?m=1")
Catch ex As Exception
lblComment.Text = "Problem With Sending Mail<br />" & ex.Message
'Response.Redirect("SentMessage.aspx?m=2")
End Try
End Sub
假设将邮件发送到选定的框。在 IE 中邮件到达,在 chrome 中它没有。
【问题讨论】:
-
如何使用VBScript?客户端?服务器端? Windows 脚本 shell 脚本?
-
为了消除混淆:asp-classic 使用了 vbscript 语言。 asp.net 不使用 vbscript。它使用 vb.net。此外,Internet Explorer 在浏览器中支持 vbscript 的变体,您可以使用它来代替 javascript,但其他浏览器不支持。
-
您发布的代码只是一个事件处理程序。当您调试时,这是否会在两个浏览器中受到影响?你有任何例外吗?错误?
-
我认为它不会在 chrome 和 firefox 中受到影响。没有异常,没有错误。
标签: vb.net