How to Run ASPNET_REGSQL on your Shared Hosting Site

By Peter Bromberg
Access over 40 UI widgets with everything from interactive menus to rich charts.

This one comes up a lot. "How can I run ASPNET_REGSQL.EXE? My shared hosting company doesn't give me access to the file system!"

Well, that's true. But you DO have access to it on your own machine. So what you do is create an empty database and run ASPNET_REQSQL.EXE against it. Then, you simply script everything using Enterprise Manager (except for the creation of the database). You put all the table, stored procedure and view creation scripts into a single SQL Script, and run it against your database at your shared hosting web site! In case you don't know exactly what to do , I've saved this script in a handy zip file here:

http://www.eggheadcafe.com/articles/ASPNET_REGSQLFULL.ZIP

You'll also need to reconfigure these settings in your web.config. Here's a sample:

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">;
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="server=(local);database=MYDATABASE;uid=myuser;pwd=mypassword"
providerName="System.Data.SqlClient" />
</connectionStrings>

<system.web>
<!-- membership provider -->
<roleManager enabled="true" cacheRolesInCookie="true" createPersistentCookie="true" >
<providers>
<add applicationName="/" connectionStringName="LocalSqlServer"
name="DefaultRoleProvider" type="System.Web.Security.SqlRoleProvider" />
</providers>
</roleManager>

<membership>
<providers>
<add connectionStringName="LocalSqlServer" enablePasswordRetrieval="true"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
applicationName="/" requiresUniqueEmail="true" passwordFormat="Clear"
minRequiredPasswordLength="3" minRequiredNonalphanumericCharacters="0"
passwordStrengthRegularExpression="" name="DefaultMembershipProvider"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
-----
Note that the application name, both in the SQL Script and the web.config is "/". Of course, you can change this.

I should also mention that the SystemWeb.Management namespace has classes with methods such as:
SqlServices.Install Method (server, user, database, password, SqlFeatures)

that will perform all these operations programmatically on any database. You can even put a call such as the above into a "utility" ASPX web page.
--Enjoy!


Submission Date:  5/6/2006 9:04:39 PM
Submitted By:  Peter Bromberg
My Home Page:  http://www.eggheadcafe.com

Popularity  (240 Views)