GoDaddy ASP.NET Issues and Solutions
I am currently working with a client and we chose GoDaddy for the host of the site. What I did not know is that GoDaddy is pretty restrictive in terms of trust (Medium trust environment).
I ran into some hiccups and I want to share the solutions for others that have had similar problems:
That assembly does not allow partially trusted callers.
This took me awhile to figure out. Here's what I did to fix it:
I made sure all three assemblies in the Bin directory were strongly named and had the [assembly: AllowPartiallyTrustedCallersAttribute()] in the Assembly.cs files of each project.
Note: All three DLLs were my own so I could edit them. If you are using 3rd party components, make sure they have the above attribute and are strongly named. Most big components should.
Tip: When I added that attribute to Assembly.cs and built the projects, then copied the DLLs to the host, I still got the Security Exception. To fix it, I deleted both the bin and obj folders from each project, built them, then copied over the new DLLs to my web site application project and subsequently to the FTP site. I don't know why, but that worked.
Failure sending mail
This was a quick fix. I was using System.Net.Mail to send email. Using smtpout.secureserver.net and port 25 worked on my local server but not on GoDaddy's server. Instead you need to use relay-hosting.secureserver.net.
Example web.config section that I use (goes after </system.web>):
<system.net>
<mailSettings>
<smtp from="mailbox@mydomain.com">
<network host="relay-hosting.secureserver.net" port="25"
userName="mailbox@mydomain.com" password="myPassword"/>
</smtp>
</mailSettings>
</system.net>
It's a good idea to make sure mailbox@mydomain.com is a real account setup on GoDaddy.