ASP.NET MVC Web Config Email Settings
I'm trying to include some SMTP settings in my ASP.NET MVC project by adding the following to my Web.Config file:
<system.net>
<mailSettings>
<smtp>
<network
host="host"
port="25"
userName="username"
password="password" />
</smtp>
</mailSettings>
</system.net>
This usually works fo开发者_Go百科r me in a standard ASP.NET application however in MVC, it's causing my site to render as blank (no source code in the browser atall).
My application builds ok so I assume I'm just missing a key piece in the MVC model.
Turns out that the answer is to include the settings inside of the <configSections>
, after the <sectionGroup>
section.
Putting the code before the <sectionGroup>
tagset seems to result in the blank result I was experiencing.
I got an error when I put this in the <ConfigSections>
group, however it worked when I put it immedietly after </ConfigSections>
. Are you sure you didn't put it outside the <configSections>
?
精彩评论