gpt4 book ai didi

c# - 从经典 ASP 到 ASP.NET 的代码转换

转载 作者:太空宇宙 更新时间:2023-11-03 16:46:54 24 4
gpt4 key购买 nike

我的客户在他的专用服务器上有一个经典的 ASP 站点,他在该站点上使用 IIS 发送邮件(它在那里正常工作)。

Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "localhost" ' Specify a valid SMTP server
Mail.Username = "mail@site.com"
Mail.Password = "password"
Mail.From = "info@site.com"

我试过像这样将其转换为 ASP.NET。

SmtpClient smtp = new SmtpClient();
smtp.Host = "localhost";
smtp.Port = 25;
//smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("mail@site.com", "password");

smtp.Send(message);

但这行不通。它几乎是没有任何错误记录器/监控的遗留应用程序,我无法调试在线服务器上的代码。

我的代码有什么问题?

最佳答案

这似乎是一个权限问题。检查这个thread了解详情。

关于c# - 从经典 ASP 到 ASP.NET 的代码转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5623763/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com