Let ASP.NET 2.0 create “ASPNETDB.mdf” in my own database

The ASP.NET version 2.0 membership feature provides secure credential storage for application users. It also provides a membership API that simplifies the task of validating user credentials when used with forms authentication.(MS)

when we create users and roles by selecting menu “ASP.NET Configration” wizard,  it will create a sql server express file named “aspnet.mdf”, but most of time I have my own database for my projects, If I use these 2 seperat database, it will not convenient to deploy. so is it possible let asp.net 2 create those built-in tables, schemas, store procedure into my own database ?

I tried and I got successful. The following steps are what I did:

1: Create your own database in Visual Web Developer 2005 Express Edition using Database Explorer or Solution Explorer. i.e: its name is MyDB.mdf (this is a SQL Sqlsever instance database file);

2: Right click this database – MyDB.mdf, select “Modify Connection…”;

3: You will see the Modify Connection window:

4: Change Data source, click the “Change…” button on the right side of Data Source textbox, select Microsoft SQL Server and click OK:

5: Then back to Mofify Connection Window, fill “[Your computer name]\SQLEXPRESS” into Server name textbox, if you have set authentication access to sql server express when you installed sQL Server Express, select “Use SQL Server Authentication”, input Username and Password, Otherwise, just select “Use Windows Authentication”;  and select “Attach a database file”, click “Browse” butthon, locate your own database file that you created in Step 1 (“MyDB.mdf”) and select it, click OK:

For my case, I just use Windows authentication.

6: Later , if you check your database by right click it, you will find “Data Source” has been changed to “Microsoft SQL Server Database File (SqlClient)” automatically, but I still have to do followed the above steps since I want to add my own database into [My machine name]\ExPRESS server;

7: Now, I can use “aspnet_regsql.exe” tool to create the built-in schema, tables and sprocs for the users and roles of ASP.NET 2.0 ;

locate the file “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe” and double click it to run;

8: Next:

9: Change “Server” from the original text to “[Your Computer Name]\SQLEXPRESS” (My case is: 09B-036-D001\SQLEXPRESS)

10: Click Next until Finish:

11: Now I go back to my Visual Web Developer 2005 Express, I found my own database MyDB.mdf have been inserted some data tables, schema, store procedures… They just are what I mentioned in step 7.

12: Modify “connectionStrings” in web.config:

<!– add name=”LocalSqlServer” connectionString=”data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true” providerName=”System.Data.SqlClient”/ –>
<remove name=”LocalSqlServer”/>
<add name=”LocalSqlServer” connectionString=”Data Source=09B-036-D001\SQLEXPRESS;AttachDbFilename=C:\MyCodes\VisualStudio2005Express\WebSites\WebSite1\App_Data\mydb.mdf;Integrated Security=True” providerName=”System.Data.SqlClient”/>

Why remove LocalSqlServer just because this name has been added into machine.config in the folder “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG”.

OK, now, I have finished my task : let asp.net 2.0 create the built-in data into my own SQL Server 2005 Express database. in fact, If I want to create those data into my own SQL Server 2005 database (not 2005 Express), it is easier than what I descripted above, because I dont need “record” my 2005 Express data file onto EXPRESS server, I can just start from step 7 (Or visit ScottGu’s blg : http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx)

Creating MS Word Document using VB.Net, XML and XSLT

This simple program demostrate how to create well formatted MS Word documents using VB.Net, XML and XSLT. Using XSLT to create Word document requires the knowledge of RTF key words. RTF specification is available in MSDN site.

1. Open Visual Studio .NET and select File –> New –> Project.

2. Select Visual Basic project as the Project Type and Windows Application as the Template. For the project name, specify ‘VBXSLT’; for the path specify the location where you want the project to be created. Click OK to create the new project.

3. Add an XML file named “Employee.xml” in \Debug\Bin directory (other wise you have to specify the path in the program). The structure of the file will be like:

<?xml version=”1.0″ encoding=”utf-8″ ?>















































<DeptName>Human Resource</DeptName>
















4. Add an XSLT file named “Employee.xslt” in \Debug\Bin directory (other wise you have to specify the path in the program). The structure of the file will be like,

<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:msxsl=”urn:schemas-microsoft-com:xslt” xmlns:dt=”urn:schemas-microsoft-com:datatypes” xmlns:user=”urn:my-scripts”>

<xsl:output method=”text” />

<xsl:template match=”Employee”>


<!–Print the Header Row–>

<xsl:text>\trowd\cellx2500\cellx3000\cellx3800\cellx6800\cellx9144\intbl\keepn\ql\b Name\cell Age\cell Sex\cell Address\cell Department\cell</xsl:text>


<!–Print Employee Records–>

<xsl:apply-templates select=”Record” />



<xsl:template match=”Record”>

<xsl:text>\trowd\cellx2500\cellx3000\cellx3800\cellx6800\cellx9144\intbl\keepn\ql </xsl:text>

<xsl:value-of select=”EmpName” />

<xsl:text>\cell </xsl:text>

<xsl:value-of select=”EmpAge” />

<xsl:text>\cell </xsl:text>

<xsl:if test=”EmpSex=’M'”>


<xsl:text>\cell </xsl:text>


<xsl:if test=”EmpSex=’F'”>


<xsl:text>\cell </xsl:text>


<xsl:value-of select=”EmpAddress” />

<xsl:text>\cell </xsl:text>

<!–Print Employee Department–>

<xsl:apply-templates select=”Department” />




<xsl:template match=”Department”>

<xsl:value-of select=”DeptName” />



5. In Form1.vb, add the following references

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Xml
Imports System.Xml.Xsl
Imports System.Xml.XPath
Imports System.IO

6. In Form1.cs, add a button and write the following code

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim ds As DataSet

Dim xmlDoc As XmlDataDocument

Dim xslTran As XslCompiledTransform

Dim root As XmlElement

Dim nav As XPathNavigator

Dim writer As XmlTextWriter


‘Create the DataSet from the XML file

ds = New DataSet()


‘Create the XML from the DataSet

xmlDoc = New XmlDataDocument(ds)

‘Load the XSLT for Transformation

xslTran = New XslCompiledTransform()


‘Determine the Root object in the XML

root = xmlDoc.DocumentElement

‘Create the XPath Navigator to navigate throuth the XML

nav = root.CreateNavigator()

‘First delete the RTF, if already exist

If File.Exists(“Employee.rtf”) Then


End If

‘Create the RTF by Transforming the XML and XSLT

writer = New XmlTextWriter(“Employee.rtf”, System.Text.Encoding.Default)

xslTran.Transform(nav, writer)

‘Close the Writer after Transformation


‘Release all objects

writer = Nothing

nav = Nothing

root = Nothing

xmlDoc = Nothing

ds = Nothing

MessageBox.Show(“Document created successfully…..”)

Catch ex As Exception

writer = Nothing

nav = Nothing

root = Nothing

xmlDoc = Nothing

ds = Nothing


End Try

End Sub

7. Compile and run the program.


How to update MS.NET Classifieds Starter kit Template in VS2005?

I installed Classifieds Starter Kit Beta Version before. Today I just found there was a Final version come out. I downloaded the new one and double clicked the .vsi file and installed. But later I found there are two Classifieds Starter Kit templates and their names are the same in my VS 2005.

So, how can I delete the old template?


1: Although I cannot delete a template I can offer a work around. The “final” version of the template creates tables that begin with “classified_” (e.g. “classifieds_Ads” and “classifieds_Location”). In may case the second download was listed after the first one in the template list. Create a new site using the second entry and check to make sure that the files have the “classifieds_” prefix.

2: I was able to delete the beta starter kit by deleting the zip file in C:\Documents and Settings\Jim\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual Web Developer. There will be one with the “class-final” name — that is the one you want to keep.
(must delete the template .zip files phasically and must delete the files under both C# and VB.net folder,It is valid if you just moving, changing the template files )

Move my PHPBB2 forum to other server

I have a forum named www.sametopic.com/forums/ based on PHPBB 2. I have made many changes and improvement on the original PHPBB 2.0.20 code and added many MOD.

Now I would build another forum , and I don’t want to modify a lot of things on PHPBB 2 code, so I want to duplicate my SameTopic.com forum to the new one, and I want to create the new forum just in the same Godaddy hosting accout as my SameTopic.com forum.

Fortunately, Godaddy provide up to 25 Mysql databases to the customers then I got to create a new database easily. the next, what I should do is ‘Copy’ the old datas to the new database and copy all php files from sametopic folder to the new folder for the new forum.

Please read my detail steps, my new forum works well at present:

1: login to OLD mysql database by your OLD database login info in phpMyAdmin 2.7.0-pl2

provided by godaddy

2: Click ‘Databases’ on the right frame (Don’t select ‘Export’ directly), select database

name such as ‘dbsametopic’;

3: Click ‘Check All’ to select all tables;

4: Click ‘Export’ on the top ;

5: You will now get a screen with quite a few options. Select the options listed below for

the least amount of incompatibility:


Complete insertsExtended inserts
Export Type: INSERT
Save as file (with newer versions you can also choose a name, whatever you like).

Then create a SQL file on your computer as your specified folder;

6: Create a NEW mysql database on your Godaddy account;

7: Login to the NEW mysql database management (phpMyAdmin 2.7.0-pl2 ) ;

8: Click ‘SQL’ on the top in the right frame;

9: Open the previously mentioned SQL file by some text editor tool such as Notes or EmEditor

(if file is big);

10: Copy all the SQL scripts and paste to SQL query text area and click ‘Go’ button;

(If your SQL is small and not over the limited size, you can import it directly as the


8: Click ‘SQL’ icon on the left frame, you will see a popup window;

9: Select ‘Import files’ if your SQL file is not over the size on the right of ‘Browse’

button )

10: Since I just duplicate OLD database to a NEW database that exist in the same godaddy

account, and these two databases are PHPBB, and I just create two seperate sub folder for

OLD and NEW applications,so, for my case, I just modify ‘script_path’ to my new sub folder

in phpbb_config table of NEW database;
OR, if you have set others parameters such cookie_path, you can follow the fowllowing steps:

Your database is now imported successfully. But, we’re not done with phpMyAdmin after that.

We still have to edit some things. Normally, after the import, you will come back to the

same window (SQL). There, put the following SQL queries in the textarea:

UPDATE phpbb_config SET config_value = ‘domain_name_here’ WHERE config_name =

UPDATE phpbb_config SET config_value = ‘domain_name_here’ WHERE config_name = ‘server_name’;
UPDATE phpbb_config SET config_value = ‘path_to_phpBB’ WHERE config_name = ‘cookie_path’;
UPDATE phpbb_config SET config_value = ‘domain_name_here’ WHERE config_name = ‘script_path’;

Just replace the blue text with the appropriate values. Watch out with the cookie domain and

server name. You cannot include http:// or it will not work.

If you have a different table prefix (the standard is ‘phpbb_’), you may have to change that

in the commands above.

If you have verified that all info is filled in correctly, hit the “Go” button again. It

will update a few configuration settings.

11: Database part done, now you just copy files of the OLD sub foler’s to the NEW folder,

but, You have to change config.php file to your correct configration for NEW application, in

godaddy, different databases located different server, my sample is:


// phpBB 2.x auto-generated config file
// Do not change anything in this file!

$dbms = ‘mysql4’;

$dbhost = ‘mysqlXXX.secureserver.net’;
$dbname = ‘myNewdbName’;
$dbuser = ‘myNewdbUser’;
$dbpasswd = ‘…..(MyPassword)’;

$table_prefix = ‘(new table prefix)_’;

define(‘PHPBB_INSTALLED’, true);


12: Now you can try to visit your new subfolder and see everything works, but only some data

s got strange show (very few, this because the bug of phpMyAdmin 2.7.0-pl2 and my forum is

UTF-8 encode,don’t matter I don’t care)

support content provided by other people:

That was it for phpMyAdmin. You can now consider your database ready to go. All you need to

do now, is upload your phpBB files to the new server. So, just download them to your

computer. When done, before uploading, you will have to do one little thing. Edit

This file contains information to connect to the database and since you’re moving to another

server, you probably have new connection information.
Open the file in a plain text editor and change the values $dbhost, $dbname, $dbuser,

$dbpasswd to the appropriate ones.

Now just upload everything to your new server. If you have installed hacks like File

Attachments, Photo Albums and so forth you may have to check some file permissions. Refer to

their installation guides if you are not sure what I’m talking about (look for ‘chmod’). If

you allow avatar uploads, be sure to chmod the images/avatars directory to 777 as well. Read

the tutorials on CHMODing if you need to freshen your memory:

CHMOD File Permissions by Rapid Dr3am
CHMOD 2: Number CHMODing by Jaeboy
Windows Server File Permissions by Rapid Dr3am

Well, I guess that is that. Try accessing your forum on the new server. It should work.


About password changing in ASP.NET 2.0

Changing the Password Complexity in ASP.NET V2.0

(from: http://www.wwwcoder.com/main/parentid/258/site/5221/68/default.aspx)

One of the first things many people try with ASP.NET V2.0 (currently in Beta 2) and with the starter kits is to create a new user. Creating a new user will be common in ASP.NET version 2.0, whether it is the CreateUserWizard, a starter kit form or using the Membership namespace from code.

Scott Forsyth
One of the first things many people try with ASP.NET V2.0 (currently in Beta 2) and with the starter kits is to create a new user. Creating a new user will be common in ASP.NET version 2.0, whether it is the CreateUserWizard, a starter kit form or using the Membership namespace from code. Immediately following that is often a sigh of frustration when a fairly non-descriptive error occurs: “Please enter a different password.” What is that supposed to mean? Is it recommending passwords for us now and not pleased with the one we chose? Did the passwords not match? Even carefully double checking and trying again with a password that is 7 characters and has numbers and upper case and lower case letters triggers this non-descriptive error.

The issue is simply this: ASP.NET V2.0, at the time of writing, has a password complexity requirement of 7 characters and at last 1 non-alphanumeric character. For example, ‘Complex592PaSsWoRd’ isn’t complex enough. A space or a special character is required. Now, being cautious about security is one thing, but many of the V2.0 sites out there now are either test sites, personal or club starter kits or something fairly light. Personally I like to loosen the requirements somewhat, or even loosen them a lot and allow the user to determine how complex they want their password.

Fortunately there are a couple solutions and neither are too complex. The first solution obviously is to enter a more complex password. The second is to override the default complexity requirement and put in your own.

The provider that controls this is the membership provider. This is set by default in the machine.config file on the server. It can be changed at the machine.config file or overridden in the web.config file at the site level.

The two properties that control this are minRequiredPasswordLength and minRequiredNonalphanumericCharacters. They aren’t in machine.config by default in the Beta 2 timeframe. I’m not sure if there are plans to change this or not. To override it, simply add them to the <add name=”AspNetSqlMembershipProvider” /> section. The minRequiredPasswordLength property must be at least 1, while the minReqiredNonalphanumericCharacters property can be 0. Here is an example of the two lines to add which removes the requirements completely and allows the user to decide on their password. Don’t hold me accountable if you open this too much, but I give this example as the other extreme of the default settings.

Now, let’s say we want to do this at the web.config level. This is easy enough too. The gotcha is that because it already exists at the machine.config level, there will be a clash between the two. So, you must first “remove” the provider that is defined at the machine level and add the adjusted one back at the site level. This can all be done from your web.config file. To remove the existing one, (I’m assuming default names) you use
<remove name=”AspNetSqlMembershipProvider” />

Here is an example of a complete web.config file that could be used. If you have an existing web.config file that you want to work this into, take the section between and including <membership> and </membership> and place it in your <system.web> section.

<?xml version=”1.0″?>
<configuration xmlns=”http://schemas.microsoft.com/.NetConfiguration/v2.0″>
<remove name=”LocalSqlServer”/>
<add name=”LocalSqlServer” connectionString=”Data Source=.\SQLExpress;Integrated
Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf” />
<remove name=”AspNetSqlMembershipProvider” />
<add name=”AspNetSqlMembershipProvider”
type=”System.Web.Security.SqlMembershipProvider, System.Web, Version=,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
passwordStrengthRegularExpression=”” />

Of course anything in my example can be adjusted however you want as long as it is within an allowed range. Take note especially of the connectionStringName which is referenced in the ConnectionString section of web.config and/or machine. config. If you changed your connection string name, then make sure to update the reference to that connection string there. Another thing to take note of is the connection string in this example. That connection string will only work if Sql Server Express is installed on the server and “user instancing” is enabled. At ORCS Web for example, we disable user instancing (because of security considerations), create a database for clients when first setting up sites, and then we provide an alternative connection string which should be used instead.

That’s it. Once you set this, you’ll be able to have a password that isn’t quite so complex. This quick example only briefly covers other considerations like the connectionStringName, user instancing, type of database used and additional properties but I hope it gives enough information to lay the foundation of managing the password complexity within ASP.NET v2.0.

Scott Forsyth is the Director of IT with ORCS Web, Inc. – a company that provides managed hosting services for clients who develop and deploy their applications on Microsoft Windows platforms.

How to insert an image into a content item in Joomla

Important notice!
You need to upload the images before you insert them in content.

Joomla only allows inserting images from the /images/stories folder and one-level subfolders (e.g images/stories/yourfolder)!

If you create subfolders in images/stories, remember to copy the /images/stories/index.html into those subfolders. This prevents unwanted directory listing (and bulk image downloading) is someone tries to directly access your uploaded images.

Important notice!
You need to upload the images before you insert them in content.

Joomla only allows inserting images from the /images/stories folder and one-level subfolders (e.g images/stories/yourfolder)!

If you create subfolders in images/stories, remember to copy the /images/stories/index.html into those subfolders. This prevents unwanted directory listing (and bulk image downloading) is someone tries to directly access your uploaded images.

(it is possible, but not recommended to insert images through HTML tags)

You may upload the images using Joomla’s Media manager, The Joomla XPlorer component, or a ftp client. The important thing is to place images in images/stories. Note that your images/stories MUST be set to world-writable permissions (777).


Once you’re done with uploading go to the next step.

Login to your Joomla administration, and open a content item for editing. You’ll notice the “images” tab on the right. Click this tab and select the images you want to display in content.(see picture for details). Note that you must click “Apply” after setting image parameters(such as border or caption).


Inserting images in content items it’s fairly simple. Joomla uses the “mosimage” text enclosed in curly braces as a placeholder for images. So, when you write an article, just insert the {_mosimage_} code(without the underlines) in the place you want an image to appear. Save your content item, and check it out in frontend.

(I wrote the underlines so that Joomla does not interpret my tip as an mosimage code(tag))

You may write this code in article introtext of fulltext.

When displaying content in frontend, Joomla automatically replacest those mosimage codes with the actual images. First code gets replaced by first image, the second mosimage code occurence gets replaced with the second image, and so on. This very article is a living example.

Deleting a content item does NOT delete  any images it may contain.

Why does image publishing work like this?

As you may know, joomla features extensions called “mambots”, which alter content items just before display. This is done automatically, you only need to enable the mambot in administration backend.

The default mosimage mambot simply replaces {_mosimage_} codes with HTML code which in order to display your images in frontend. Note that the mambot does not modify your content items, it modifies on-the-fly the way content displays on your site, each time an article is viewed.

When editing a content item, you see the mosimage code, but when viewing it in the frontend, you get the image. Images names are stored in the “images” field of the mos_content database table.

Using mosimage codes for placing images in content makes easy controlling image display sitewide. An advanced image mambot such as MosThumb can automatically generate thumbnails from images, and link them to a popup window.

(From: http://www.teachmejoomla.com/joomla/mambo-tutorials-and-howtos/general-questions/how-to-insert-an-image-into-a-content-item.html  )

Changing all table names of ASP.NET 2.0 PW Stater kit and moving it to Godaddy.com (3)

Due to the statment before, my multiple asp.net projects work.

However, I have to record another quesition: After I transfer my local asp.net projects on the sub folder of godday account, I found there was no Adminitrator Account in my project! This because I could not upload my user data since asp.net 2.0 use divided database for users account. Then I have searched a way to resolve it:

What I should do are:

1. on my godaddy personal website and create an account named ‘admin’ and its password. (make sure the usernames and passwords are the same as on my local machine!!!)

2: Log back into godaddy Query Analyzer
3: Copy the following T-SQL statement into the Query Analyser window:

SELECT RoleId FROM aspnet_Roles WHERE RoleName = ‘Administrators’
SELECT UserId FROM aspnet_Users WHERE UserName=’username’ (here my username is admin)

Click Submit and get Role ID and User ID , save the return value for use in step

4: Copy the following T-SQL statement into the Query Analyser window:

INSERT INTO aspnet_UsersInRoles (RoleId, UserId) VALUES (‘<roleID>’, ‘<userID>’)

EXAMPLE: INSERT INTO aspnet_UsersInRoles (RoleId, UserId) VALUES (‘{7321ED9B-64FB-47C2-B139-2AF810678D59}’, ‘{E421C366-2905-40FC-8543-0AA618FEE17E}’)

Replace <roleID> and <userID> with the return value from step 3. Retain the single quotation marks around these values. Click Submit.

5: Copy the following T-SQL statement into the Query Analyser window:

UPDATE aspnet_Membership SET IsApproved = 1 WHERE UserId = ‘<userID>’ (this step active admin account)


The following is other people’s walkthrough for PWS installing on godaddy.com

GoDaddy Installation Walkthrough for Personal website starter kit

from www.asp.net

1. Create your site locally. Include AT LEAST 1 local admin account.
2. Run site using CTRL-F5.
3. Log into your GoDaddy hosting account and open the control panel.
4. Click on ASP.Net runtime and select 2.0
5. Click Databases > SQL Server > Create New Database.
6. Select
1. Check DSN (optional?)
2. Enter UserName (this will become the database name NOT your hosting login)
3. Enter Password (again, database password NOT hosting password)
4. Check “Install Schema Features”
7. Click Continue > Create Database (it WILL take some time for the database to create itself, you can refresh by clicking the SQL button in the left menu)
8. Once setup finishes, Click Pencil icon under actions > print this page.
9. Click Computer icon under actions > record the SQL Connection (.NET) strings
10. Click Open Manager
11. Click Connection > Enter the Username and Password from 6 above.
12. Once connected, expand Tools menu > Click Query Analyzer
13. Cut & Paste all text from club-add.sql into the Query Analyzer window

14. Click Submit (you should see many “command(s) completed successfully” below)

15. Go back to VWD and edit default.aspx
16. Go to Edit > Find & Replace > Quick Replace
1. Find dbo. (NOT Dbo. big difference)
2. Replace with <blank> (nothing, nada, zip, zero)
3. Look in: Current Document
17. Click Replace All (should be 12 or more) > Save default.aspx
18. Repeat steps 16 & 17 for:
1. Events_Edit.aspx
2. Events_View.aspx
19. Open web.config
1. Replace original text

<add name=”ClubSiteDB” connectionString=”Data Source=.\SQLExpress;

Integrated Security=true;


User Instance=True” providerName=”System.Data.SqlClient”/>

With new text

<add name=”ClubSiteDB” providerName=”System.Data.SqlClient”





<remove name=”LocalSqlServer”/>

<add name=”LocalSqlServer” providerName=”System.Data.SqlClient”





Change <customErrors mode=”Off” /> (optional)


Run CTRL-F5 again. (it will bring up a window with a server error, what you want is to look in the lower left corner of the VWD window for “Build Successful”)

Click Website > Copy Web Site > Connect

Input your hosting username and password (NOT you database uid and pwd)

Highlight all files from the left side and click right arrow to transfer.

* Go to your public website and create an account for each admin you created on your local database. (make sure the usernames and passwords are the same!!!)

Log back into Query Analyzer
28. To Grant Administrator Privileges to an ASP.NET 2.0 User Account

1. Log in to your Account Manager.
2. Under the Hosting & Email section, select Hosting Account List.
3. Next to the hosting account you want to modify, click Open.
4. Under the Databases section of the Hosting Manager, click the SQL Server icon.
5. Next to the name of your SQL Server database, click Open Manager. The SQL Server Web Admin tool displays.
6. In the tree on the left, expand the Connection folder and select Connection.
7. Enter the User Name and Password for your database. You created your user name and password when you set up your SQL server database.
8. Expand the Tools folder on the left and select Query Analyser.
9. Copy the following T-SQL statement into the Query Analyser window:

SELECT RoleId FROM aspnet_Roles WHERE RoleName = ‘Administrators’

Click Submit and save the return value for use in step 11. Click Reset.
10. Copy the following T-SQL statement into the Query Analyser window:

SELECT UserId FROM aspnet_Users WHERE UserName=’username’

Replace <username> with the user name of the account to which administrator privileges will be granted. Retain the single quotation marks around this case-sensitive value. Click Submit and save the return value for use in step 11. Click Reset.
11. Copy the following T-SQL statement into the Query Analyser window:

INSERT INTO aspnet_UsersInRoles (RoleId, UserId) VALUES (‘<roleID>’, ‘<userID>’)
EXAMPLE: INSERT INTO aspnet_UsersInRoles (RoleId, UserId) VALUES (‘7321ED9B-64FB-47C2-B139-2AF810678D59’, ‘E421C366-2905-40FC-8543-0AA618FEE17E’)

Replace <roleID> with the return value from step 9. Replace <userID> with the return value from step 10. Retain the single quotation marks around these values. Click Submit.

Thanks again to BoosterMan, and all those who made this walkthrough possible. Great Job and keep up the good work

Chaning all table names of ASP.NET 2.0 PW Stater kit and moving it to Godaddy.com (2)

I would like to put my own PWS into the sub folder on godaddy.com and I hope I can build multiple ASP.NET projects on the same godaddy ASP.NET account.

I even tried to create sub folders throught FTP tools on my godaddy hosting space, but after I finished to transfer my local files on that sub folder, I found it could not work. I thought it was not a simple operation like what I did. Then I posted my question on www.asp.net forums, a friend answered for ASP.NET project running in a sub folder, I have to ask goddaddy.com to provide me the relevant service.

Later I wrote an Email to support@godaddy.com, repidly I got their reply like the following:

Dear Sir/Madam,

Thank you for contacting Online Support.

You may specify permissions for your ASP hosting account with the following directions. Please note that the ‘Directory Management’ button will not be available if you have FrontPage extensions installed.

You can uninstall FrontPage Extensions from the ‘Other Settings’ page or modify your permissions through your website publishing software.

First, log into your customer account:

. Go to the Go Daddy Account Login Page.
. Log in using your account username (which may be the same as your customer number) and password.

If you have trouble logging in, our password reset form may help you. You can find this form through the following link:
Account Retrieval Page

Once logged in, follow these steps:

. Select ‘Web Hosting & Databases’ from the ‘Hosting & Email’ menu at the top of the page
. Click the ‘Open’ link under the Control panel heading for the hosting account you wish to manage
. Under ‘Content’ click on ‘Directory Management’
. Click the ‘Create Directory’ button
. Enter the ‘Directory / Subdirectory’ name
. Specify the permissions by checking the box under the appropriate column. (Read, Web, Browse, Write, Reset)
. Click the ‘Continue’ button
. Click ‘Add’ to confirm the update

You also have the option to remove existing folders from the list by using the reset option; this sets the folder to the correct permissions, and then removes the folder from the list.

Please let us know if we can help you in any other way.

Then I know I can get the implishment of my tasks. I created my customer directory and set on the permision to Read, Write, Web, Root Set (Application Root), I have waited for a while, about 10 minites, I saw the folder was created (I used FTP tool to watch).

Later I transfer my local asp.net website published files to this customer directory and modified web.config by giving correct connection string.

However, I still got error message when I tried to visit my PWS:

This application was precompiled with personalization turned off, but it appears to have been turned on after the precompilation, which is not supported.

I asked goddaddy.com again but they told me they don’t troubleshoot or fix custom coding. So I have to resolve it by myself.

I noticed that I have build another asp.net project on the original root folder, then I created another customer directory and move the old files from the original root folder to the new customer folder, haha! I found It works, I can visit this project by click www.mydomain.com/mycustomerdirectory2/ ! And, I found the previous project I mentioned above works too by click www.mydomain.com/mycustomerdirectory1/ ! This is great!

So the reason maybe came from I put another asp.net project to the original root folder, then, for building multiple ASP.NET 2.0 projects, I should put them to different sub folders and don’t put the original root folder? I am not sure, but I don’t care, I just want to builder multiple asp.net projects on different sub folders, this is just what I want !

the following is my connctiStrings content in my web.config file:


<add name=”Personal” connectionString=”server=whsql-v0XXX.prod.mesaXXXX.secureserver.net;
Trusted_Connection=False” providerName=”System.Data.SqlClient” />

<remove name=”LocalSqlServer”/>

<add name=”LocalSqlServer” connectionString=”server=whsql-v0XXX.prod.mesaXXXX.secureserver.net;
Trusted_Connection=False” providerName=”System.Data.SqlClient” />


(attention: XXX is hidden content)

Chaning all table names of ASP.NET 2.0 PW Stater kit and moving it to Godaddy.com (1)


I created a personal website based on MS ASP.NET 2.0 personal website starter kit on my local PC. It runs well. Once time I moved it to a free asp.net hosting provided the same environment like MS Visual studio 2005 development such as SQL Server 2005 Express. So It was very easy to migrate from local. For the database, I just copied the two .mdf files (aspnet.mdf and personal.mdf) to that hosting server and click “attach” buttons that they provided. then I got all data as same as my local’s; and then uploaded all relevant files , then, done for everything.

However, The free is not always convenient for you. some days I have not managed my site, it gone! I lost all my personal website content!
So, I bought a asp.net space from Godaddy.com and tried to move my local personal website based on starter kit to my godaddy.com space.

The following is my migrating process:

1.install MS Sqlserver management studio express;

download: http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&DisplayLang=en

2. Detach ASPNETDB.mdf and Personal.mdf on your local PC if you are using MS visual studio 2005 to open them;

3. Run Sqlserver management studio express. connnect to the sqlserver that you have intalled in ur pc.

4. in the “Object Exploer” windows, right click “Databases”, select “Attach…”, then open your database .MDF file (sql server 2005 express file);

5: right click the database file that u just now attached. select “Tasks” > “generate Scripts”. then generate sql file you want (create or drop);

Note1: I changed the “Script for Server version” to “Sql server 2000” on “Choose Script options” page since godaddy.com just provides sqlserver 2000 but not 2005)
Note2: I selected tables and store processes, create SQl to a file
NOTE3: sqlserver management studio express can not generate data for you ,just generate empty table stucture!! so I have to add data manually! but you can use the 3rd part script to backup and insert your part of data (see following content), then if I have lots of data, the sqlserver management studio express is no useful!

(Sure you can get your data if you use backup and restore option. But for me, the tables name changed, so I can not use backup and restore ways )

5: u can use these sql file to build your database on remote hosting for ur asp.net project. attention the sqlserver version on the remote hosting, u can select sql server version when u generate script file;

6: u can change the tables name through these sql file. just change the tables name manually in .sql file, then run sql script file on remote hosting;(right click database name and select “new query”, then copy the content of sql file and then excute)

7: detach the database file from sql server management express;

8: open visual studio 2005, u need to change the asp.net code for the changing of table and store precedures’ name

9: sqlserver management express can not generate sql file for data, just backup, so if you changed the table name , u have to copy data from original tables to new tables one by one manual; OR,

you can use this script , it is a very good script:
How ever, it can not copy image field, so for image fields, I had to download from old project and then upload to new project one by one manually.

more notes about use the above script:

1: after download the script, copy to notepad, should turn off notepad’s word wrap;
2: copy the script to SQL Server Management Express’ SQL Query window;
3: open a new SQL query windows and copy the following codes, this is to  generate INSERT statements for all the tables in your database, execute the following query in that database, which will output the commands, that you need to execute for the same:

SELECT ‘EXEC sp_generate_inserts ‘ +
‘[‘ + name + ‘]’ +
‘,@owner = ‘ +
‘[‘ + RTRIM(USER_NAME(uid)) + ‘],’ +
‘@ommit_images = 1, @disable_constraints = 1’
FROM sysobjects
WHERE type = ‘U’ AND
OBJECTPROPERTY(id,’ismsshipped’) = 0

4: excute the above script and I will get the result like the following in the result window of SQL Server Management Express:

EXEC sp_generate_inserts [sysdiagrams],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1
EXEC sp_generate_inserts [PWS_SiteContent],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1
EXEC sp_generate_inserts [PWS_Albums_Special],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1
EXEC sp_generate_inserts [PWS_Photos_Special],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1
EXEC sp_generate_inserts [PWS_Projects],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1
EXEC sp_generate_inserts [PWS_Albums4FileSys],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1
EXEC sp_generate_inserts [PWS_Photos4FileSys],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1
EXEC sp_generate_inserts [PWS_Albums],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1
EXEC sp_generate_inserts [PWS_Photos],@owner = [dbo],@ommit_images = 1, @disable_constraints = 1

5: copy the above script and paste into a new SQL Query script window and excute them;

I would get the insert script of my personal site database (no include ASPNETDB database) for data insertions

6: Copy the final script and paste into SQL Query window of Godaddy account….

when I tried to submit and execute them , I got errors because the following reason, then I deleted those script cause these errors , just let good scripts run firtly.

Those fields are about images, I have to   insert image by manual when my website run, Don’t try to insert default or others values like the following way , just let the PWS_Photos and PWS_Photos_Special tables empty firtly, later when website run I insert images one by one manually :

I have to modified the above data insert script manually because in my database there are some images fields are not nullable, but the above script do not include this un_nullable fields such as thoes images field in photos tables,

I added default values (”) for those images fields (ie: largeimage), for example:

INSERT [dbo].[PWS_Photos_Special] ([id],[title],[albumid],[notes],[largeimage])VALUES(1,’Indigo Projects Management’,1,NULL,”)
INSERT [dbo].[PWS_Photos_Special] ([id],[title],[albumid],[notes],[largeimage])VALUES(2,’ALE’,1,NULL,”)
INSERT [dbo].[PWS_Photos_Special] ([id],[title],[albumid],[notes],[largeimage])VALUES(3,’GMLC’,1,NULL,”)
INSERT [dbo].[PWS_Photos_Special] ([id],[title],[albumid],[notes],[largeimage])VALUES(4,’I3DVR’,1,NULL,”)
INSERT [dbo].[PWS_Photos_Special] ([id],[title],[albumid],[notes],[largeimage])VALUES(5,’GSM’,1,NULL,”)
INSERT [dbo].[PWS_Photos_Special] ([id],[title],[albumid],[notes],[largeimage])VALUES(6,’NetEase’,1,NULL,”)
INSERT [dbo].[PWS_Photos_Special] ([id],[title],[albumid],[notes],[largeimage])VALUES(7,’Railway Military’,1,NULL,”)
INSERT [dbo].[PWS_Photos_Special] ([id],[title],[albumid],[notes],[largeimage])VALUES(8,’SCP’,1,NULL,”)

Here is another good article for how to move sqlserver database to remote hosting:

(用sqlserver management express时,可以同时attach旧的和新的mdf文件,但是旧的在attach时要修改一下attach as到新的路径,即和新的mdf文件不要一样的路径就行了。)

for the tables’ prefix string changing, just add my prefix string for all tables one by one, and change my asp.net codes in files.

login to godaddy.com and access to your asp.net database, open it , use Qurery Analyst tool, copy all your .sql content and paste into Qurery Analyst, run it.。

But I got an error:

CREATE TABLE [dbo].[PWS_SiteContent](
[TextID] [int] NOT NULL,
[Homepage_Welcome] [varchar](max) NULL,
[Homepage_WhatsNew] [varchar](max) NULL,
[Homepage_WhatsUpLately] [varchar](max) NULL,

Line 11: Incorrect syntax near ‘max’.

later I will write how I resovle this problem.

Finally I found SQL Server doesn’t support (max), I changed (max) to (4000), then works!