CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  ASP.NET

關於ASP.net問題,請大家幫忙,分不夠可以加!

楼主danstu(一片风)2003-12-04 10:53:48 在 .NET技术 / ASP.NET 提问

文件:<%@   import   namespace="system.web.mail"   %>  
  <html><body>  
  <form   runat="server"   enctype="multipart/form-data">  
  <table   border=1>  
  <tr><td>收件人:</td>  
  <td><asp:textbox   runat="server"   id="mailto"   size=45   /></td><tr>  
  <td>發信者:</td>  
  <td><asp:textbox   runat="server"   id="mailfrom"   size=55   /></td><tr>  
  <td>主題/td>  
  <td><asp:textbox   runat="server"   id="mailsubject"   size=66   /></td></tr>  
  <tr><td>內容:   </td>  
  <td><asp:textbox   runat="server"   id="mailbody"   textmode="multiline"   rows=9   cols=66   /><br>  
  <asp:radiobuttonlist   runat="Server"   repeatdirection="horizontal"       id   ="format"   repeatcolumns="2">  
  <asp:ListItem   Selected>xx</asp:listitem>  
  <asp:listitem>yy</asp:listitem>  
  </asp:radiobuttonlist>  
  </td>  
  </tr><tr><td>上傳文件</td><td>  
  <input   type="file"   runat="server"   id="fil"   /></td>  
  </table>  
  <asp:button   runat="server"   onclick="click"   text="發送"   />  
  </form>  
  <asp:label   runat="Server"   id="msg"   forecolor="red"   />  
  </body>  
  </html>  
  <script   language="vb"   runat="server">  
  sub   click(sender   as   object,e   as   eventargs)  
  dim   mail   as   mailmessage=new   mailmessage  
  mail.to=mailto.text  
  mail.from=mailfrom.text  
  mail.subject=mailsubject.text  
  mail.body=mailbody.text  
  if   format.selecteditem.text="xx"   then  
  mail.bodyformat=mailformat.text  
  else  
  mail.bodyformat=mailformat.html  
  end   if  
  dim   fils   as   httppostedfile=fil.postedfile  
  if   fils.contentlength   <>   0   then  
  dim   xy()   as   string=split(fils.filename,   "\"   )  
  dim   name   as   string=xy(xy.length-1)  
  fils.saveAs(server.mappath(name))  
  dim   attach   as   new   mailattachment(server.mappath(name))  
  mail.attachments.add(attach)  
  end   if  
  on   error   resume   next  
  smtpmail.smtpserver="0101host.com"  
  smtpmail.send(mail)  
  if   err.number   <>   0   then  
  msg.text=err.description  
  else  
  msg.text="成功發送"  
  end   if  
  end   sub  
  </script>  
   
  我把此文件上傳到支持ASP。net的空間後,訪問時:為什麼會出現以下錯誤提示:  
  Server   Error   in   '/'   Application.  
  --------------------------------------------------------------------------------  
   
  Runtime   Error    
  Description:   An   application   error   occurred   on   the   server.   The   current   custom   error   settings   for   this   application   prevent   the   details   of   the   application   error   from   being   viewed   remotely   (for   security   reasons).   It   could,   however,   be   viewed   by   browsers   running   on   the   local   server   machine.    
   
  Details:   To   enable   the   details   of   this   specific   error   message   to   be   viewable   on   remote   machines,   please   create   a   <customErrors>   tag   within   a   "web.config"   configuration   file   located   in   the   root   directory   of   the   current   web   application.   This   <customErrors>   tag   should   then   have   its   "mode"   attribute   set   to   "Off".  
   
   
  <!--   Web.Config   Configuration   File   -->  
   
  <configuration>  
          <system.web>  
                  <customErrors   mode="Off"/>  
          </system.web>  
  </configuration>  
     
   
  Notes:   The   current   error   page   you   are   seeing   can   be   replaced   by   a   custom   error   page   by   modifying   the   "defaultRedirect"   attribute   of   the   application's   <customErrors>   configuration   tag   to   point   to   a   custom   error   page   URL.  
   
   
  <!--   Web.Config   Configuration   File   -->  
   
  <configuration>  
          <system.web>  
                  <customErrors   mode="RemoteOnly"   defaultRedirect="mycustompage.htm"/>  
          </system.web>  
  </configuration>  
     
  請大家幫我,謝謝!文件沒有錯的! 问题点数:50、回复次数:12Top

1 楼denny510(小单尼)回复于 2003-12-04 11:00:03 得分 10

您确定您在服务器有运行.NET应用程序的权限吗?Top

2 楼denny510(小单尼)回复于 2003-12-04 11:02:48 得分 10

可能的原因:你使用的SMTP有效吗?一般你使用127.0.0.1就可以了。Top

3 楼javacofe(sa)回复于 2003-12-04 11:03:38 得分 0

up  
  Top

4 楼aero_boy(老牛)回复于 2003-12-04 11:16:25 得分 10

服务器上给你建   了虚拟目录没,问问你租宣空间的地Top

5 楼danstu(一片风)回复于 2003-12-04 14:37:09 得分 0

有啊,他支持ASP.net的,而且我上传时,也是上传到wrooot文件下  
  on   error   resume   next  
  smtpmail.smtpserver="0101host.com"  
  smtpmail.send(mail)  
  if   err.number   <>   0   then  
  msg.text=err.description  
  else  
  msg.text="成功發送"  
  end   if  
  上面这句话中的0101host.com是不是对的,我是在此网站申请的域名,空时是在别的网站申请的!  
  错误提示是什么回事?  
  Top

6 楼webdiyer(.net资源精华—www.dotneturls.com)回复于 2003-12-04 21:00:49 得分 10

打开你的web.config文件,将其中的    
  <customErrors   mode="RemoteOnly"   defaultRedirect="mycustompage.htm"/>  
  改为  
  <customErrors   mode="Off"   defaultRedirect="mycustompage.htm"/>  
  然后再打开上面的页面,将详细的出错信息帖上来。  
   
  Top

7 楼danstu(一片风)回复于 2003-12-05 11:55:47 得分 0

谢谢,试试先!Top

8 楼danstu(一片风)回复于 2003-12-05 12:03:51 得分 0

我的文件是这样的没有错啊,请大家帮忙啊!555555555  
  <configuration>  
      <system.web>  
          <globalization   requestEncoding="gb2312"   responseEncoding="gb2312"   />  
          <compilation   debug="true"/>  
          <customErrors   mode="Off"/>  
      </system.web>  
  </configuration>  
  Top

9 楼webdiyer(.net资源精华—www.dotneturls.com)回复于 2003-12-05 12:54:22 得分 10

不是你的web.config文件有错,而是因为你原来的web.config文件中没有将customErrors设为off,因此服务器没有显示具体的错误信息,也就是什么地方出错之类的信息,你只要将customErrors设为Off,然后再打开原来的页面,具体的出错信息就会显示出来了。Top

10 楼danstu(一片风)回复于 2003-12-08 19:38:33 得分 0

下面是错误提示,我已经按您说的改了,而且从新上传了!  
  Server   Error   in   '/'   Application.  
  --------------------------------------------------------------------------------  
   
  Runtime   Error    
  Description:   An   application   error   occurred   on   the   server.   The   current   custom   error   settings   for   this   application   prevent   the   details   of   the   application   error   from   being   viewed   remotely   (for   security   reasons).   It   could,   however,   be   viewed   by   browsers   running   on   the   local   server   machine.    
   
  Details:   To   enable   the   details   of   this   specific   error   message   to   be   viewable   on   remote   machines,   please   create   a   <customErrors>   tag   within   a   "web.config"   configuration   file   located   in   the   root   directory   of   the   current   web   application.   This   <customErrors>   tag   should   then   have   its   "mode"   attribute   set   to   "Off".  
   
   
  <!--   Web.Config   Configuration   File   -->  
   
  <configuration>  
          <system.web>  
                  <customErrors   mode="Off"/>  
          </system.web>  
  </configuration>  
     
   
  Notes:   The   current   error   page   you   are   seeing   can   be   replaced   by   a   custom   error   page   by   modifying   the   "defaultRedirect"   attribute   of   the   application's   <customErrors>   configuration   tag   to   point   to   a   custom   error   page   URL.  
   
   
  <!--   Web.Config   Configuration   File   -->  
   
  <configuration>  
          <system.web>  
                  <customErrors   mode="RemoteOnly"   defaultRedirect="mycustompage.htm"/>  
          </system.web>  
  </configuration>  
     
  谢谢了!为了这个真的很没有办法啊!Top

11 楼danstu(一片风)回复于 2003-12-12 09:34:42 得分 0

好了,决定放弃这个问题,那我如果想在本地机算机上调试,也就是能发邮件,请问朋友希要下载什么组件吗?Top

12 楼webdiyer(.net资源精华—www.dotneturls.com)回复于 2004-02-07 18:34:28 得分 0

用asp.net发邮件不需要下载任何组件,.net框架中相应的类,在System.Web.Mail命名空间中。Top

相关问题

  • ASP可以include .NET的函数吗?请高手帮忙。来者有分。。。。。。。。。。》》》》》》》》》》》
  • ASP。NET没能解决的高难度问题,来这里请各位高手帮忙。分不够再加
  • 大家好,我初学ASP。NET,那位能帮个忙?
  • 帮忙,ASP。NET初学者的问题,谢谢了。
  • ASP NET的代码分离??
  • net_lover帮忙
  • 请asp+server高手帮忙分析一个sql语句
  • asp程序能在.net环境用吗?各位大哥帮忙啊
  • 请大伙帮忙提供 动态增加上传控件的组件(ASP。NET)
  • 有没有谁真正在ASP。NET里面用过MY SQL的,请帮忙

关键词

  • asp.net

得分解答快速导航

  • 帖主:danstu
  • denny510
  • denny510
  • aero_boy
  • webdiyer
  • webdiyer

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo