locked
Info about 1and1 hosting for beginners RRS feed

  • Question

  • User145501902 posted
     Journal – Setting up a “Townhall” website (My thanks to Jeremy H and yousaid for getting me here)

    My objective is to create a “Townhall” Website for the citizens of the City of Cushing, OK. I intend to begin by using the “classifieds” website starter kit from Microsoft (but instead of “things to sell”, each ad will be a mini-webpage for local businesses). Later I hope to add the timetracker starter kit (to allow local service clubs to track donations to charity), and a PHPBB-based forum as an “online townhall”, for threads such as, “What questions do you have for the Mayor?”. See www.cushingshops.com

    We shall attempt to present a very step-by-step (“cookbook”) approach, with a lot of “cut-and-paste”.

    Email me at tcscushing@aol.com for code samples (only useful for absolute beginners).

    Downloads from here: http://msdn.microsoft.com/vstudio/express/default.aspx

    Microsoft MSDN 2005 Express Edition, Visual Web Developer 2005 Express Edition, with Reporting Add-ins, Visual Basic, Visual C#, Visual C++, Visual J#, SQL Server Express, MS SQL Server 2005, Server Mgmt Studio Express SP2, Native Client, Setup Support Files (English), VSS Writer, MSXML 6.0 Parser

    Website Starter Kits (downloaded, installed, and seem to work)

    http://msdn.microsoft.com/vstudio/express/vwd/starterkit/default.aspx

    MS .Net Framework 1.1/2.0/SDK, MS Platform SDK, User-mode Driver Feature Pack 1.0

    Open Office, J2SE Java Runtime

    Download latest Classifieds Starter Kit from: http://www.asp.net/downloads/starterkits/

    This gave me a 647 kb file named class.vsi, Executing this gave me a template in VWD2005Exp (Visual Web Designer), Starting new website gave me a working website folder in VWD2005Exp, “classifieds1”, Save-all, exit, re-open classifieds website, highlight default.aspx, ctl-f5 to start execution, Click on “register”, enter admin-member info, exit/save-all, re-open classifieds website, Following instructions near the bottom of the welcome.html, used the asp.net Web Site, Administration Tool to set the role of the only user in the database, to both “administrator” and “guest” (but I think only “administrators” was necessary)

    Started the application (locally, within VWD2005Exp using ctrl-f5 and IE7), added a normal user, tested logging on to both existing users. The admin could see the admin-function tab, guest could not. I was able to create and “ad” with pictures for the guest member.

    Setting up 1and1 hosting specs/prep

    This is a $10 a month MS Hosting site, supporting asp.net 2.0, deleted their original files from the root directory.

    I set up FTP permissions using the 1and1 control panel, and created a “main” subdirectory (and a couple other test directories). I replaced the “default.asp” in the root directory with a “redirector” script, and placed test default.aspx “parking” pages in each subdirectory, to test my redirector. The following shows 1and1's example of an asp script redirector:

    http://faq.oneandone.co.uk/script_cookbook__databases/asp_net/asp_net_2_0/1.html

    I then set the “main” subdirectory (folder) to all possible permissions, and also indicated that it was an “application” thru the 1and1 control panel. This is the application name you will need for the setup of the membership in web.config file. Also from “webfiles” of the 1and1 control panel, set “write” permissions for the “upload” subfolder, and for the “site-config.xml” file within the App_Data subfolder.

    Note: 1and1 will not allow you remote access to the SQL Database, so you can't run aspnet_regsql.exe directly against your database.

    I set up a blank database thru the 1and1 control panel, went into the database admin, and noted the info needed to set my web.config connection strings.

    I moved all files from the “classifieds” folder locally to the “main” folder at my site. I removed the copies of my local databases from the “App_Data” folder (ASPNETDB.MDF, and CLASSIFIEDSDB.mdf, and .ldf and .log files). I modified the web.config connection string, and other source files as noted.

    On my local PC, I set up a .bat file to run aspnet_regsql.exe as a commandline process to create a .sql script which would create the “aspnet” portion of my database. On my PC, it was in:

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe

    (Set up a .txt file in the same folder as the aspnet_regsql.exe, change the extension to .bat, and edit it to look like this:)

    <TT>aspnet_regsql.exe -S [mssqlxx.1and1.com] -U [dboyyyyyyyyy] -P [zzzzzzzz] -A all </TT>

    <TT>-d [dbyyyyyyyyy] -sqlexportonly [aspnet_add.sql]</TT>

    I guess you can make out the options here

    -S = your 1and1 sql server (xx) instance name

    -d = Database/DB Owner name (yyyyyyyyy and password zzzzzzzz)

    -sqlexportonly = the name of the file you need, in this case “<TT>aspnet_add.sql” is created.</TT>

    <TT>(I think the -U [dboyyyyyyyyy] -P [zzzzzzzz] switches were not necessary)</TT>

    I used the 1and1 MS-SQL admin, <TT>mylittleadmin tool, tools, Query Analyser </TT>tool to run this script, specifying where on my local PC the script was. Then tables, stored <TT>procedures, and </TT><TT>views were created, for the “aspnet functions” portion of the DB out on 1and1.</TT>

    Do I care about SQL CACHE DEPENDENCY OPTIONS? (Jeremy replies:) - Well I have yet to really need this on any start kit project that I have worked on but you can read more if you want at http://msdn.microsoft.com/en-us/library/ms229862(vs.80).aspx - Also this may help you http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=1130

    Using the same 1and1 MS-SQL admin tool, I ran the scripts from the App_Data folder (open each of these with notepad, classifieds-add.sql, and classifieds-categories.sql, copy, paste, and run each from the text window of the query analyzer). This created the Classifieds database, with its tables, views, and stored procedures, as well as setting up the initial categories. Now both Databases that had been on my local PC were combined into 1 DB out on my 1and1.  From the MS SQL Admin tool, you should be able to see aspnet and the classified tables, noting that there are 7 entries under the categories, and 2 entries under the roles.  (Do NOT run the "classifieds-remove.sql" script, as it will remove your previous work).

    We used internet explorer and went to cushingshops.com, and created the first member. Then we used “Users.aspx” (contributed by JeremyH, located in the “Main” subdirectory, and later moved to the “admin” subdirectory) to set the role of the first member to “administrators”.

    We then added a “guests” member, and used this logon to create an “ad”, complete with pictures.

    <TT>Other notes and techniques: (Mostly from JeremyH)</TT>

    <TT>Well the "aspnet_UsersInRoles_GetRolesForUser" procedure I deleted when I was checking with the connection string and the web.config so I could be sure that I had a hard error to work from. </TT><TT>To put it back I just cut the text from the sql file we made to setup the aspnet function database and copied into the query editor in sql admin on 1and1 and that added it.</TT>

    <TT><snip></TT>

    <TT>CREATE PROCEDURE dbo.aspnet_UsersInRoles_GetRolesForUser</TT>

    <TT>@ApplicationName nvarchar(256),</TT>

    <TT>@UserName nvarchar(256)</TT>

    <TT>AS</TT>

    <TT>BEGIN</TT>

    <TT>DECLARE @ApplicationId uniqueidentifier</TT>

    <TT>SELECT @ApplicationId = NULL</TT>

    <TT>SELECT @ApplicationId = ApplicationId FROM aspnet_Applications </TT>

    <TT>WHERE LOWER(@ApplicationName) = LoweredApplicationName</TT>

    <TT>IF (@ApplicationId IS NULL)</TT>

    <TT>RETURN(1)</TT>

    <TT>DECLARE @UserId uniqueidentifier</TT>

    <TT>SELECT @UserId = NULL</TT>

    <TT>SELECT @UserId = UserId</TT>

    <TT>FROM dbo.aspnet_Users</TT>

    <TT>WHERE LoweredUserName = LOWER(@UserName) AND ApplicationId = @ApplicationId</TT>

    <TT>IF (@UserId IS NULL)</TT>

    <TT>RETURN(1)</TT>

    <TT>SELECT r.RoleName</TT>

    <TT>FROM dbo.aspnet_Roles r, dbo.aspnet_UsersInRoles ur</TT>

    <TT>WHERE r.RoleId = ur.RoleId AND r.ApplicationId = @ApplicationId </TT>

    <TT>AND ur.UserId = @UserId</TT>

    <TT>ORDER BY r.RoleName</TT>

    <TT>RETURN (0)</TT>

    <TT>END</TT>

    <TT></snip></TT>



    > There are two databases, the aspnet and the classifieds. On the local machine, the aspnet db is created during the first run by Visual Web Developer 2005 Express, it is created when you run the project (F5) or when you use the ASP.NET Configuration tool.

    > Running aspnet_regsql.exe on the local machine, when this is run in GUI mode, it attempts to hook to the DB that is specified. But when run as a commandline, it just cranks out a sql script, and this script seems to be the same, whether or not it refers to an actual DB. The simplest logic is to create a hosted database then use an install script for the main application database, then add the aspnetdb with the install script created by the command line tool aspnet_regsql.

    > The difference between the aspnet DB which has "DBO." as its owner and the classifieds DB which has "DBOyyyyyyyyy" as its owner. Where do we differentiate? Well the DBOyyyyyyyyy is your named SQL Server login account (User) to the 1and1 sql server that gives you full rights to your database but SQL Server has a "dbo." fixed server role which means the owner of that database. So from a web.config or connection string point of view you have to use the username (DBOnumbers) and password pair (for the classifieds db portion) but within sql server you can use the fixed role (that is, only “DBO.”, for the aspnet portion of the 1and1 database).

    > How do I "backup" a local DB.MDF file to make a .BAK file? You need to have SQL Server Management Studio or the express version to do that (first move a copy of the .mdf and .ldf and log to a directory close to the root of your local PC's hard drive root directory) then you right click on the database, then “tasks” and “backup”. Then you would need the isp/host to allow you to restore the database onto their server (which 1and1 seems to allow), You can end up with problem doing this if username and permission and version are not the same. I think the best route is install scripts as this give you much more control.

    > In the documentation for 1and1, it says that the first time you "publish" (move the source to the public server's folder), it is a good idea to enable frontpage extensions and use Visual Web Designer Express to copy the stuff to the server. This somehow registers the applications or something. Was this necessary, or could I have only used FTP exclusively? (Jeremy replies:) Yes ftp is fine. The Copy web site in VWD is slow for some reason and the ftp copy does not need frontpage extensions, I am not 100% sure why you need frontpage extensions but I think its todo with Webdav, http transfer. I have read that Microsoft is not releasing any new version of the extensions.

    Code samples:


    WEB.CONFIG: Note changes must be made to xx, yyyyyyyyy, and zzzzzzzz below. Get this information from the 1and1 control panel, MS-SQL, admin for your database.

    Also when you have finished setting up and testing the website you should change <compilation debug="true"/> to <compilation debug="false"/> this will speed up the site and allow caching of the pages.


    <?xml version="1.0"?>

    <configuration>

    <location path="Admin">

    <system.web>

    <authorization>

    <allow roles="Administrators"/>

    <deny users="*"/>

    </authorization>

    </system.web>

    </location>

    <location path="PostAd.aspx">

    <system.web>

    <authorization>

    <deny users="?"/>

    </authorization>

    </system.web>

    </location>

    <location path="EditPhotos.aspx">

    <system.web>

    <authorization>

    <deny users="?"/>

    </authorization>

    </system.web>

    </location>

    <location path="MyAds.aspx">

    <system.web>

    <authorization>

    <deny users="?"/>

    </authorization>

    </system.web>

    </location>

    <location path="MyProfile.aspx">

    <system.web>

    <authorization>

    <deny users="?"/>

    </authorization>

    </system.web>

    </location>


    <system.web>

    <customErrors mode="Off"/>

    <authentication mode="Forms"/>

    <!--<identity impersonate="true"/>-->

    <compilation debug="true"/>

    <pages styleSheetTheme="Red"/>


    <membership defaultProvider="CustomizedMembershipProvider" >

    <providers>

    <add name="CustomizedMembershipProvider"

    type="System.Web.Security.SqlMembershipProvider"

    connectionStringName="LocalSqlServer"

    enablePasswordRetrieval="false"

    enablePasswordReset="true"

    requiresQuestionAndAnswer="true"

    applicationName="/main"

    requiresUniqueEmail="true"

    passwordFormat="Hashed"

    maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"

    minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"

    passwordStrengthRegularExpression=""/>

    </providers>

    </membership>

    <profile enabled="true">

    <properties>

    <add name="FirstName" type="System.String"/>

    <add name="LastName" type="System.String"/>

    <add name="MemberId" defaultValue="0" type="System.Int32"/>

    <group name="Core"/>

    </properties>

    </profile>


    <roleManager enabled="true" defaultProvider="CustomizedRoleProvider">

    <providers>

    <add name="CustomizedRoleProvider"

    type="System.Web.Security.SqlRoleProvider"

    connectionStringName="LocalSqlServer" />

    </providers>

    </roleManager>


    <siteMap defaultProvider="RoleEnabled_AspNetXmlSiteMapProvider" enabled="true">

    <providers>

    <clear/>

    <add name="RoleEnabled_AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" siteMapFile="web.sitemap" securityTrimmingEnabled="true"/>

    </providers>

    </siteMap>

    </system.web>


    <connectionStrings>

    <add name="classifiedsConnection" connectionString="server=mssqlxx.1and1.com;

    initial catalog=dbyyyyyyyyy; uid=dboyyyyyyyyy; Pwd=zzzzzzzz"/>

    <remove name="LocalSqlServer"/>

    <add name="LocalSqlServer" connectionString="server=mssqlxx.1and1.com;

    initial catalog=dbyyyyyyyyy; uid=dboyyyyyyyyy; Pwd=zzzzzzzz"/>

    </connectionStrings>


    <!--<system.net>

    <mailSettings>

    <smtp>

    <network host="yourSMTPhostname" port="25" defaultCredentials="true" userName="enterUserNameHereIfRequired" password="enterPasswordIfRequired"/>

    </smtp>

    </mailSettings>

    </system.net>-->

    </configuration>



    USERS.ASPX: (used to change the role of an existing member to “administrators”) (contributed by jeremyh)

    This page is put into the “/main” folder (modify the redirector to call it one time) to change the role of the first member. Then delete the reference to it in the redirector script in the root 1and1 directory. Also, move the users.aspx and .cs to the admin folder, and modify the /admin/default.aspx to call it.

    (SECURITY WARNING! THIS PAGE MUST BE MOVED FROM /MAIN AFTER FIRST USE!)

    Download code from:  http://home.mchsi.com/~j.roal/Users.zip

    See notes from the author:  http://forums.asp.net/t/1028620.aspx  jroal  http://www.jimroal.com/

    >end of document

    Tuesday, May 15, 2007 1:44 AM

Answers

  • User-1705717250 posted

    Also in the sample web.config above you should change

    <customErrors mode="Off"/>

    to

    <customErrors defaultRedirect="Error.aspx" mode="RemoteOnly"/>

    This is a more secure setting as it will not pass as much information to the viewing user.

    Sorry missed it before

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 15, 2007 2:13 PM

All replies

  • User-1705717250 posted

    Also in the sample web.config above you should change

    <customErrors mode="Off"/>

    to

    <customErrors defaultRedirect="Error.aspx" mode="RemoteOnly"/>

    This is a more secure setting as it will not pass as much information to the viewing user.

    Sorry missed it before

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 15, 2007 2:13 PM
  • User145501902 posted

    Sent From: blazie151
    Subject: Your a genius...

    How did you generate the sql files for the other databases? I am trying to set up the commerce starter kit on 1and1 and I'm having the hardest time ever. I know I'm really close, I think the only problem that I still have is that I can't get the information stored in my local CommerceDB.mdf file into the MS SQL db that was created and stored on the hoster. Any help would be greatly appreciated.

    ===========================

    Thanks for your kind words.  Let me make clear that I received a lot of help, mostly from jeremyh, to get my site to work.

    Let me restate what we said in the forums.  When you create the website locally, there are two databases created (at least for the classified-ads starter kit).  The first is automatically created by the VISUAL WEB DEVELOPER EXPRESS, and it contains the tables/view/stored-procedures that are the standard aspnet tools.  Also, the other database is shipped with the webpage, so it already exists within the starterkit, and it is the tables/view/stored-procedures that are specific to the classified-ads.

    There two methods of "moving" this to the public-host-system.  You must choose ONE method.

    First, you can generate a script on your local pc, and when this is run on the host it will create the aspnet database.  Also with this, the webpage source-files include another script that can be run, which will create the application-specific portion of the database.

    But, instead of the above, you can use another method.  This is to download the Server Management Studio Express SP2 from Microsoft, and use it to create .BAK (backup versions) files from your local database files.  Then the public-host-system presumably has some method to import these files to be your online database files.

    Monday, May 21, 2007 10:36 PM
  • User-1705717250 posted

    Well the Commerce Starter Kit is a little different in it deploying, The best route is to upload (ftp) the files to the server then using your browser goto yourdomain.com/install/default.aspx and follow the steps to build the sql databases it takes care of all the scripts for you.

    Oh before running the install/default.aspx you will need to setup a blank database using the 1and1 control panel, take note of the server name, database name, user name and password as you need them for the default.aspx page.

    You will need to update the web.config with the connection string info and change the application name in the membership section if you do not name the application CSK.

    One major problem you may have is this from http://forums.commercestarterkit.org/

    It's important to note that the CSK only works in Full Trust. Most ISPs will only allow .NET 2.0 Web sites to run in Partial Trust (aka Medium Trust). This won't allow the CSK to make Web Service calls to PayPal (or the gateway of your choice) so please make sure you ask your ISP if they will support full trust. Some ISPs that do are:

    DiscountASP
    WebHost4Life

    I believe that if 1and1.com is the same as 1and1.co.uk you can only run applications in Medium Trust http://faq.oneandone.co.uk/script_cookbook__databases/asp_net/11.html

    I have used both of the ISP's above and would strongly recommend them in the following order 1st http://www.discountasp.net/ 2nd  http://www.webhost4life.com/.

    Hope it helps

    Tuesday, May 22, 2007 4:10 AM
  • User-1705717250 posted

    Oh one more thing with Commerce kit do not leave the _Dev directory on a live site make sure you delete it after use.

    Tuesday, May 22, 2007 5:31 AM
  • User-1333467738 posted

    I thank you for the info. I guess now I'm moving to another host, again. I tried 1and1 at first, didnt like their customer service or plans that much and switched to godaddy. I quickly found out that their query analyzer doesnt work right when parsing in sql scripts and moved back to 1and1. Now I guess I will be shuting down my accounts with them and switching to either webhost4life or re-invent. I'm thinking webhost4life simply because they offer unlimited bandwidth and a huge db size for a cheap price, whereas with re-invent its low disk space, low bandwidth, and a 175mb top-off to the db. Webhost4life's site is very sluggish though, and I'm wondering if their hosting is also that slow. I don't want someone clicking through my pages at dial-up speeds. Which host would you reccomend?
     

    Tuesday, May 22, 2007 10:40 PM
  • User-1705717250 posted

    Well I have been with webhost4life for a number of years and have had no problems and the sites have not been slow at all. Plus you get full remote access connection with sql manager.

    The best host I feel is discountasp.net better customer support, more server controls and again full sql access.

    Hope it helps you move home.

    Good luck

    Wednesday, May 23, 2007 3:50 AM
  • User-1333467738 posted

     Ironically enough, I'm trying to sign up with webhost4life, and their sign up pages are working incorrectly. Its adding in their turbo charge feature when you click no thanks. I contacted their support and got some guy named Wing that didn't speak English with correct grammar. Do they out-source their calls or did I just get the new guy?

    Wednesday, May 23, 2007 9:14 AM
  • User-1705717250 posted

    Well support have always been fine, but i tend to email or use they logging system.

    Take a look discountasp, give them a call. I would have to say that they are the best host i have ever used but i guess twice the price of webhost4life.

    Best of luck

    Wednesday, May 23, 2007 9:53 AM
  • User-1333467738 posted

     I found out a workaround to get signed up with them. I had to edit the address bar to properly select the options that I wanted. I just finished the sign up process and when I get my login info I will be going online and setting up site. When its all done I will post it up here for you guys to see and comment on.

    Wednesday, May 23, 2007 2:01 PM
  • User2006515656 posted

    Thanks for this post as it helped me to finally get my ASP .Net login components to work on my website hosted on 1and1. I was really starting to lost hope there for a while.   I've been using 1and1 for a while and have not had any difficulties with their hosting up until this point.  Now I just have to figure out if there is some work around to get Ajax to work on their servers!

    Sunday, September 9, 2007 12:28 PM
  • User145501902 posted

    I used PAINTDOTNET to modify all the .jpg and .gif files.  So, per the Microsoft EULA, I now have copyright/right to sell my copy of the this MS Starterkit.  Thank you Microsoft.

    The color codes were easy enough to figure out.  I used the express version of web designer, and "fiddled" within the design view, until I could see a "..." after one of the fields in the bottom right of the screen.  Clicking on this, I got the color editor.  If you click on the color wheel, the equivalent color "code" is displayed. Go to the far-right tab, and you get slide bars for each of the primaries.  After experimenting, and writing down the codes I wanted, I then cancelled and then "hard-coded" the color codes directly into the theme-file.

    That is, I went into AppThemes folder, and copied the folder "RED" to "TCS".  Then went into web.config and changed one of the lines to:

    <pages styleSheetTheme="TCS"/>

    Then I changed colors as needed in the "default.css", as well as substituting all .jpg and .gif images with my versions, within the "TCS" folder.  Modifying the web.sitemap file changed the labels on my tabs.

    A note about the "color code".  Note that each pair of hex digits represents the strength of one of the primaries (ie, red, green, blue).  All full strength, white.  All zero, black.  All three pairs of values equal to each other, some shade of gray.

    Now, my next project was to prepare to make subdomains available to local non-techy people.

    My domain is www.cushingshops.com or, cushingshops.com and 1and1 will let me have a couple hundred subdomains.  I bring up the web page, and navigate to the "ad" I had placed for myself.  I noted that it is ad number "4".  I copied the address at the top of the page, and pasted the result into my "redirector" (the default.asp in my root folder).  Looks like this:

    <html>
    <head runat="server">
        <title>Redirector</title>
    </head>
    <body>
        <form runat="server">
        </form>
    <%EnableSessionState=False

    host = Request.ServerVariables("HTTP_HOST")

    if host = "cushingshops.com" or host = "www.cushingshops.com" then
    response.redirect("http://cushingshops.com/main/default.aspx")

    elseif host = "test.cushingshops.com" then
    response.redirect("http://cushingshops.com/Main/ShowAd.aspx?id=4")

    else
    response.redirect("http://cushingshops.com/error.html")

    end if
    %>
    </body>
    </html>

    Then I went into my 1and1 control panel, and set up a subdomain named "myshop.cushingshops.com". It worked great!

    Next, I will be working on how to make the full-sized pic to be bigger on the screen, so that each picture will display as it's own "webpage".  See http://cushingshops.com for examples of work in progress.

    Sunday, September 16, 2007 10:39 PM
  • User145501902 posted

    After trying to work with 1and1 for a year and some months, I have become convinced that they are a rip-off, and I would not recommend them

     

    TomT

    tcscushing@aol.com

    Wednesday, June 25, 2008 1:33 PM
  • User-1705717250 posted

    Tom sorry to hear you are having problem. If you need a new host be sure to check out discountasp.net great all round company and good support.

    Also they have great offers from time to time with 3 or 6 months off http://www.discountasp.net/signup/special/6f81a/

    good luck

    Wednesday, June 25, 2008 2:00 PM