小编ner*_*mik的帖子

如何从Web.config中读取system.net/mailSettings/smtp

这是我的web.config邮件设置:

<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="smthg@smthg.net">
        <network defaultCredentials="true" host="localhost" port="587" userName="smthg@smthg.net" password="123456"/>
      </smtp>
    </mailSettings>
  </system.net>
Run Code Online (Sandbox Code Playgroud)

这是我如何尝试从中读取值 web.config

 var smtp = new System.Net.Mail.SmtpClient();
 var credential = new System.Net.Configuration.SmtpSection().Network;

 string strHost = smtp.Host;
 int port = smtp.Port;
 string strUserName = credential.UserName;
 string strFromPass = credential.Password;
Run Code Online (Sandbox Code Playgroud)

但凭据始终为空.我如何访问这些值?

c# smtp sendmail web-config

59
推荐指数
3
解决办法
5万
查看次数

在Html.ActionLink中使用"data-toggle"

我想在actionLink中使用"data-toggle".像这样;

 Html.ActionLink("Delete", "Users", "Admin", new { item.UserId , strRole = strRole }, new { id = "cmdDelete", href="#myAlert",  data-toggle="modal" })
Run Code Online (Sandbox Code Playgroud)

不幸的是,不接受.我如何像标准链接一样使用"数据切换"?

c# html.actionlink asp.net-mvc-4

35
推荐指数
2
解决办法
3万
查看次数

Asp.net MCV4框架问题

我使用VS 2012和MVC4创建了一个网站,它是我的本地主机,但是当我发布并放置我的主机它不起作用.IIS配置是一样的.但它给了我这个错误行:

这是错误;

Configuration Error 
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, '<compilation targetFramework="4.0">'). The 'targetFramework' attribute currently references a version that is later than the installed version of …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc-4

11
推荐指数
3
解决办法
3万
查看次数

比较mysql中的两个表

我有两个表,第一个(table1)有28500行,另一个(table2)有17450行.我想比较这些表,发现table1行中不存在.

SELECT * FROM table1 WHERE ID NOT IN (SELECT DISTINCT(ID) FROM table2)
Run Code Online (Sandbox Code Playgroud)

有什么建议吗?

mysql compare

6
推荐指数
1
解决办法
2万
查看次数

MVC4,两个不同的主页

如何在我的web项目中使用mvc4使用两个不同的母版页或布局?

asp.net layout master-pages asp.net-mvc-4

3
推荐指数
1
解决办法
4544
查看次数

SQL Where子句条件

在sql where子句中; 如果pv.SalePrice是的话null,我想用pv.Price.我怎样才能做到这一点?

WHERE    
    @FilterRangePriceValueMin < pv.SalePrice OR pv.SalePrice is null
     AND (@FilterRangePriceValueMax > pv.SalePrice OR pv.SalePrice is null)
Run Code Online (Sandbox Code Playgroud)

c# sql where where-clause

3
推荐指数
1
解决办法
517
查看次数