Server.MapPath中的错误附加HTml文件? [英] error in Server.MapPath to attach a HTml file ?

查看:59
本文介绍了Server.MapPath中的错误附加HTml文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 StreamReader reader = new StreamReader(Microsoft.SqlServer.Server.MapPath(〜/ invitemail.htm)); 



i有效关于asp.net邮件概念..现在我在编码方面很挣..请帮助..

i我在我的html文件中设计一个邀请邮件并附加到邮件正文....

i在上面的行中有错误:

我的错误是:




CS0234:类型或命名空间名称'MapPath'在名称空间'Microsoft.SqlServer.Server'中不存在(您是否缺少程序集引用?)


解决方案

 Server.MapPath( 〜/ invitemail.htm

就足够了。 Microsoft.SqlServer没有名称空间'Server'(AFAIK)。


您好,

您可以访问html并附加到正文中,如下所示:

  string  Body = System.IO.File.ReadAllText(Server.MapPath( 〜/ invitemail.htm)); 



希望有所帮助。


最后我得到了一个解决方案...

以下代码是正确的...我得到了一个解决方案:

 StreamReader reader = new StreamReader(HttpContext.Current.Server.MapPath(〜/ htmldesign.htm)); 



感谢所有..


StreamReader reader = new StreamReader(Microsoft.SqlServer.Server.MapPath("~/invitemail.htm"));


i have working on asp.net mail concept.. now i am struggle in that coding.. please help..
i am design a invite mail in my html file and attach to mail body....
i have a error in that above line:
my error is:



CS0234: The type or namespace name 'MapPath' does not exist in the namespace 'Microsoft.SqlServer.Server' (are you missing an assembly reference?)

解决方案

Only

Server.MapPath("~/invitemail.htm")

is sufficient. Microsoft.SqlServer does not have a namespace 'Server' (AFAIK).


Hi,
You can access html and attach in body as below:

string Body = System.IO.File.ReadAllText(Server.MapPath("~/invitemail.htm"));


Hope it helps.


hi finally i got a solution for this one...
below code is correct one.. i got a solution:

StreamReader reader = new StreamReader(HttpContext.Current.Server.MapPath("~/htmldesign.htm"));


thanks to all..


这篇关于Server.MapPath中的错误附加HTml文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆