How To

How to recompile the MySQL library to run under the Medium Trust environment for enom web hosting

Member
By AminTaheri
eHow Community Member
(4 Ratings)

eNom has configured the .NET 1.1 and 2.0 environments to run in a customized medium trust environment.

The MySQL libraries must be modified to run under this environment since they use a non trusted code module, .Net will error out.

This article describes how to recompile the MySql/Connector library to run under this version of medium trust.

Difficulty: Easy
Instructions

Things You'll Need:

  • Visual Studio 2003 for asp.Net 1.1
  • Visual Studio 2005 for asp.Net 2.0
  • Enom Web hosting account
  • FTP Client
  1. Step 1

    Download the source code for the MySQL Connector/Net from http://dev.mysql.com/downloads/connector/net/1.0.html

    Note the Version 1.0 is for the connector, not for .Net version.

  2. Step 2

    Extract the contents of the zip file to a local directory.

  3. Step 3

    Open mysql.csproj project file in Visual Studio.

  4. Step 4

    Open the AssemblyInfo.cs file, and add the following code, in the using block, at the top of the file (if it is not already there):

    using System.Security;

  5. Step 5

    Add the following code to the assembly section of the file:

    [assembly: AllowPartiallyTrustedCallers]

  6. Step 6

    Recompile the dll.

  7. Step 7

    You may now reference this dll from other projects. When you decide to publish your project to your hosting server, you need to upload this modified version of the dll to your bin directory.

  8. Step 8

    If this is too much, you can download precompiled DLLs direct from eNom's control panel.
    http://webhosting.enom.com/HP2/help/FAQ.aspx#faq_d19

    MySQL .NET Connector v1.07 for .NET 2.0 http://webhosting.enom.com/HP2/download/MySql.Data.dll

    MySQL .NET Connector v1.07 for .NET 1.1 http://webhosting.enom.com/HP2/download/MySql.Data1.1.dll

Tips & Warnings
  • If you are running PHP4, do not use MySQL5, and if you are using PHP5 do not use PHP4 - each version of MySQL uses different responses to PHP code that is not correctly interpreted by the other language. Even if your code is correct it will generate a connection error since php doesnt know how to interpret the response correctly.
  • If you use the precompiled versions, you will need to remove and re-add the reference in your project

Post a Comment

Post a Comment

Have you done this? Click here to let us know.

I Did This

Related Ads

Internet
Virginia DeBolt,

Meet Virginia DeBolt eHow’s Internet Expert.

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US

Demand Media
eHow_eHow Technology and Electronics