Last post Sep 01, 2010 01:10 PM by Rook1969
Mar 31, 2010 03:19 PM|mone82|LINK
GoDaddy is playing with my emotions! I got the Security exception error when connecting to MySQL database. I followed the steps suggested by the GoDaddy support on this forum at http://forums.asp.net/t/999456.aspx?PageIndex=1 but I still have the exception!
i downloaded the latest version of the data connector, added the [assembly: AllowPartiallyTrustedCallers] to the AssemblyInfo.cs, built the solution again, put the generated dll in a Bin folder on my website, ran it and nothing happend
Have I done something wrong?
I'm pissed because they posted the solution here and when I sent them an email asking for support they said "The error you are encountering is due
to the Trust Level that is set on shared server hosting. Your program is attempting to use Full Trust settings, however, shared hosting is set at Medium. In order to have Full Trust enabled you will need to move up to a Virtual Dedicated Server."
That's redicolous!!!! Do this DLL thing work for real?
This is my code, in case you have some doubts of what I am doing.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
<asp:BoundField DataField="data2" HeaderText="data2" InsertVisible="False" ReadOnly="True" SortExpression="data2" />
<asp:BoundField DataField="data3" HeaderText="data3" SortExpression="data3" />
<asp:CheckBoxField DataField="receive" HeaderText="receive" SortExpression="receive" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand=" SELECT `data1`, `data2` FROM `table` LIMIT 5 ">
And the web.config
<add name="ConnectionString" connectionString="Server=servername; Port=3306; Database=databasename; Uid=username; Pwd='password';" />
May 31, 2010 03:00 PM|erunamo|LINK
I had the same problem. I realized I could use the code behind file to query the database directly but using the SqlDataSource was giving me a security error in my GoDaddy hosting account.
I tried downloading the source to recompile the connector like GoDaddy suggests (http://help.godaddy.com/article/1496) but I realized the source code for the newest connector (6.2.3 at the time of writing)
already has that in it.
Then I found another answer on these forums (http://forums.asp.net/p/1117728/1820700.aspx) which helped me with the solution.
All I had to do was add the following to my web.config file after the connection strings section (and have the .dll in my bin folder):
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,Version=6.2.3,Culture=neutral"/>
SQLDAtasource WITH MYSQL
MySql .NET Connector
Jun 29, 2010 12:02 PM|Jerryfan72|LINK
Thanks a lot, just solved a 2 week crisis.
Sep 01, 2010 11:28 AM|Rook1969|LINK
I am having the same trouble on GoDaddy. I am using vs2010 and the 184.108.40.206 version of the connector. I've tried several solutions so far. Including recompiling the MySql.Data.dll and the MySQL.Data.Entity.dll and placing them in my bin directory. I generated
a new signing key and signed both as well as made sure the [assembly: AllowPartiallyTrustedCallers()] was in both AssemblyInfo files. It was already there for the MySQL.Data.dll but not the MySQL.Data.Entity.dll.
I then added this to my project web.config:
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,Version=220.127.116.11 ,Culture=neutral, PublicKeyToken=b44677552c335d6a"/>
My project is hosted at:
if you want to see the error page.
Do you have any other suggestions for making this work?
Sep 01, 2010 12:09 PM|Jerryfan72|LINK
You shouldn't have to recompile anything. This is what I used:
Framework Data Provider for MySQL"
I see that you are actually using a newer version of the connector though. Maybe you can try to find the one I used? Also, make sure this goes in <system.data>.
Sep 01, 2010 01:10 PM|Rook1969|LINK
Thanks for the reply.
I have now moved to the production MySQL connector version of 6.2.4 and switched my development environment to VS2008. I used your lines above in my config file (aside from the version change). Also, the files are in the bin directory.
Everything seems to work for now. So it looks like my problem was either .Net 4.0 or the development versions of the mySQL dlls or VS 2010.
Thanks for the help.