HowTo: N2 Cms install
At N-Web Design, we love writing really cool applications for our clients.
This is a passion shared by many developers to the extent that they share their work as open source applications, freely available under various open source licenses.
Now as much as we love writing bespoke code, we hate re-inventing the wheel. That's why we like, where possible, to use open source apps and frameworks. It cuts our development time way down, saves our clients money and also offers a stable platform that has little or no ownership issues because of the open source licensing model.
Anyway, enough of the why, let's look at what and how?
N2 Cms (http://www.n2cms.com/) is an open source web application framework, written in c#/asp.net, which allows you to create content managed websites.
Without going into too much detail (this isn't a review after all) N2 is a content management system that is really simple, powerful, well written and can be easily deployed into new or existing web applications. This makes it the ideal candidate for building an asp.net CMS or using as a base system for your own CMS framework. You can apply N2 Cms to Webform or MVC based applications. We are going to use the MVC sample project in this tutorial, but it will work fine with Webform examples too.
Ok, how do we get started and take a look?
This HowTo is aimed at those people who are new to N2, asp.net MVC and have limited skills with .net development so if you are an asp.net development Ninja, some of the explanations are quite simplistic. If you are a 'beginner' expect it to take about 30 minutes.
There are some pre-requisites for using N2 Cms. You need .NET 3.5, asp.net MVC and a development environment. This HowTo also covers adding SQLExpress as the chosen database, but the example we use initially uses SQLLite. This may be enough for you to begin using N2 and is certainly perfect for development and evaluation purposes.
This example is done on Vista Ultimate, with IIS7. If anything, it will be easier on XP so don't worry if that is your flavour of OS.
So you have Visual studio 2008 or web developer, SQLExpess (if required) and asp.net MVC? If you don't know anything about asp.net MVC or haven't got it installed, you should go to the website (http://www.asp.net/mvc/) and watch the videos. If you don't have at least a basic understanding of MVC, you'll get a bit confused at the file structure in this example, which may frustrate you and turn you off N2 Cms, which would be a bad thing, as N2 is really cool.
The how bit...
Download the source code from http://n2cms.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29374#ReleaseFiles. Just get it all. We'll tell you which bit to use, so don't worry about how much stuff there is.
Extract 'sources.zip' to your hard drive. It doesn't matter where. We are going to put the right files in wwwroot or wherever you serve IIS from.
Create an empty folder in c:\inetpub\wwwroot (or wherever you like to run sites from) called n2 or similar.
From the extracted files, copy the contents of sources/examples/mvc/wwwroot into the new n2 folder in wwwroot.
Create a new folder called n2 in you VS 2008 projects location (Mine is User\Documents\ Visual Studio 2008\Projects)
Copy the Mvc_Example.sln file from sources/examples/Mvc to the n2 folder in your chosen location for VS projects.
Open the Mvc_Example.sln file from your projects/n3 folder in a text editor like notepad. Don't use a rich editor like word. and edit the value "wwwroot\MvcTest.csproj" on line 4 to the location of your web site, ie: c:\inetpub\wwwroot\n2\MvcTest.csproj. This just tells solution where you have put the application so it knows where to find the files when you run the project.
Open the project in VS 2008. You should get a file list. If not, check the editing in the .sln file and the locations you have used.
Next, click on the 'show all files' icon in the solution explorer, then right click on 'edit', 'bin' and 'obj' respectively and 'select add to project for each'. This will take a few minutes.
Ok, now we will set up IIS. On the desktop, right click on 'My Computer' and select 'Manage'. You'll get some version of MMC popping up. Navigate to 'sevices and applications', then IIS Manager. Open the Default Web Site from the droppy arrow things and find the n2 folder. It will be displayed as a folder icon. We need to make it into an application. To do this, right click on the icon and select 'convert to application'. Just leave the defaults in place and press ok.
Next, click on the n2 application icon, and some options will appear in the panel to the right. At the bottom under IIS, select 'authentication', then under 'Action' in the far right panel, select 'Open Feature' then enable Window Authentication. You may get an alert but just ignore it. You need windows auth to debug and forms auth to use forms based authentication. (There's probably a fix/hack/workaround for the error, but I've never had any problems with it).
Now go back into VS and press F5. You should now see a blue default vanilla MVC web page. That meas it all works. It's installed. Cool...
Go to http://localhost:12345/edit and you should see the N2 login. Use the default login username/password for access (this is written into the web config for this example, but Membership should be easy to add to projects) which are admin/changeme.
If you are logged in ok, then it means everything is fine. You have a simple starting install of N2 inside an asp.net MVC application. You should now go and read some more, play with templates and generally feel good about this great app.
Changing the basic install to use SQL Server Express.
Why would you want to do this?
Well, if you use SQL Server Express for live projects, it probably makes sense to make the config work in dev how it will in production. The installation above uses the SQLLite file DB, which is fine for evaluation and testing but it is likely you will want to use SQL Express, so here's how.
This assumes you have the N2 install above working fine and have SQL Server Express installed.
My example is using 2005 Express, but 2008/10 should work the same.
First thing. Open the project in VS 2008 and open the web.config file.
Find the <connectionStrings> node and comment out the active string.
Uncomment the SQL Express connection string. Note it uses the AttachDBFilename parameter and Integrated Security. In this example, we will be using the SQL Server on localhost and a SQL Server login. (Again, this makes deployment to a live box a little easier and safer).
Edit the connection string to be something like:
<add name="N2CMS" connectionString="Data Source=.\SQLEXPRESS;Database=N2;User ID=n2-user;Password=n2user" providerName="System.Data.SqlClient"/>
You can use any database name, user and password you like.
We will now set up the DB in SQL Server Express.
Open SQL Management Studio (Remember to run as administrator).
Right click on databases and select 'create new'. Give the database the name you used in the web.config connection string.
Add new login called n2-user (or the name you used in the web config connection string), select SQL Server Authentication and give it your chosen password.
Click on 'User Mapping' and select the new database in the top panel.
In the bottom panel, named Database role membership, select db_owner.
You can micro-manage user permissions a lot in SQL Server but it is out of the scope of this article. If you don't know what selecting db_owner means for your database security, please read some articles about SQL Server roles and permissions.
You can test the login by using it to access SQL Server via management studio, but it should all be fine.
Next, go back to Visual Studio and F5. This runs the app.
You shouldn't get any errors, but if you do, please check the web config settings are correct and that the database and logins are all configured properly.
If all is well, you will be shown a configuration screen with a welcome tab an five step tabs.
Please read all this information carefully, but essentially because we have changed the connection to use a SQL Express db, N2 checks the database, sees it is empty and then helps us to set it up properly with all the tables and stored procs we need.
From the welcome (having read and understood it all of course) select 'start installation'.
Follow the instructions on step 1 and 2. On step 3, read the text and then select 'create tables'.
Step 4 asks about root nodes. For the purpose of this example, just select 'content page' on the 'use one node for both' option. This basically sets up where your site has its home page. It's worth reading about root and content nodes.
Step 5 mentions log-ins and Membership. Please read this and then continue.
You should now be taken to the site home page. If this is displayed correctly, everything is fine. You can navigate to /edit and play with the options and functions there.
I hope this helped you to get started with N2 Cms.
If you have any suggestions, notice any typos or have something to contribute to this article, please add coment.
What to do next?
I'm going to follow this up (yeah, right!) with some other tutorial stuff based on my own experiences that will cover topics such as:
Creating and editing templates
Adding roles and membership
Creating custom controls and content
Thanks for reading.
/ed..
TrackBacks
-
ohntrkit on 25/01/2010 12:40am
ohntrkit
-
cialis on 27/01/2010 1:35am
cialis
-
ginseng on 27/01/2010 1:35am
ginseng
-
vicodin on 27/01/2010 1:35am
vicodin
-
biaxin on 27/01/2010 1:35am
biaxin
-
acai diet on 27/01/2010 1:35am
acai diet
-
elavil on 27/01/2010 1:35am
elavil
-
cetirizine on 27/01/2010 1:36am
cetirizine
-
flomax side effects on 27/01/2010 1:36am
flomax side effects
-
fioricet on 27/01/2010 1:36am
fioricet
-
motrin on 27/01/2010 1:36am
motrin
-
vzqkptza on 27/01/2010 8:11am
vzqkptza
-
strattera on 29/01/2010 9:12am
strattera
-
actonel on 29/01/2010 9:12am
actonel
-
bactroban on 29/01/2010 9:12am
bactroban
-
accutane on 29/01/2010 9:12am
accutane
-
zoloft on 29/01/2010 9:12am
zoloft
-
actonel on 29/01/2010 9:12am
actonel
-
ginseng tea on 29/01/2010 9:12am
ginseng tea
-
bactroban on 29/01/2010 9:12am
bactroban
-
zoloft on 29/01/2010 9:12am
zoloft
-
buy vicodin on 29/01/2010 9:12am
buy vicodin
-
bwzuewme on 29/01/2010 3:48pm
bwzuewme
-
buspar on 31/01/2010 6:54pm
buspar
-
buy prozac on 31/01/2010 6:54pm
buy prozac
-
simvastatin on 31/01/2010 6:54pm
simvastatin
-
simvastatin on 31/01/2010 6:54pm
simvastatin
-
buy levitra online on 31/01/2010 6:54pm
buy levitra online
-
azithromycin on 31/01/2010 6:54pm
azithromycin
-
buy tramadol online on 31/01/2010 6:54pm
buy tramadol online
-
hoodia gordonii on 31/01/2010 6:55pm
hoodia gordonii
-
citalopram on 31/01/2010 6:55pm
citalopram
-
cozaar on 31/01/2010 6:55pm
cozaar
-
gsjswgpq on 01/02/2010 2:17am
gsjswgpq
-
wellbutrin sr on 03/02/2010 3:41am
wellbutrin sr
-
generic wellbutrin on 03/02/2010 3:41am
generic wellbutrin
-
paroxetine on 03/02/2010 3:41am
paroxetine
-
crestor side effects on 03/02/2010 3:41am
crestor side effects
-
actonel on 03/02/2010 3:41am
actonel
-
buy phentermine on 03/02/2010 3:41am
buy phentermine
-
buy ultram on 03/02/2010 4:56am
buy ultram
-
alesse on 03/02/2010 4:56am
alesse
-
green tea on 03/02/2010 4:56am
green tea
-
lamisil on 03/02/2010 6:07am
lamisil
-
avandamet on 03/02/2010 6:07am
avandamet
-
avodart on 03/02/2010 6:07am
avodart
-
order viagra online on 03/02/2010 7:39am
order viagra online
-
prilosec otc on 03/02/2010 7:39am
prilosec otc
-
arava on 03/02/2010 7:40am
arava
-
lamisil on 03/02/2010 7:40am
lamisil
-
medrol on 03/02/2010 7:40am
medrol
-
tadalafil on 03/02/2010 8:48am
tadalafil
-
order phentermine on 03/02/2010 8:48am
order phentermine
-
maxalt on 03/02/2010 8:48am
maxalt
-
singulair on 03/02/2010 8:48am
singulair
-
diflucan on 03/02/2010 8:48am
diflucan
-
prozac side effects on 03/02/2010 8:48am
prozac side effects
-
maxalt on 03/02/2010 8:48am
maxalt
-
maxalt on 03/02/2010 8:48am
maxalt
-
singulair on 03/02/2010 8:49am
singulair
-
maxalt on 03/02/2010 8:49am
maxalt
-
ecjdoydf on 03/02/2010 4:06pm
ecjdoydf
-
stromectol on 03/02/2010 9:16pm
stromectol
-
naproxen on 03/02/2010 9:16pm
naproxen
-
flomax side effects on 03/02/2010 9:16pm
flomax side effects
-
diazepam on 03/02/2010 9:16pm
diazepam
-
dramamine on 03/02/2010 9:17pm
dramamine
-
cialis soft on 03/02/2010 9:17pm
cialis soft
-
famvir on 03/02/2010 10:42pm
famvir
-
prilosec on 03/02/2010 10:43pm
prilosec
-
acai diet on 03/02/2010 10:43pm
acai diet
-
nitrofurantoin on 03/02/2010 10:43pm
nitrofurantoin
-
diflucan on 03/02/2010 10:43pm
diflucan
-
ultram tramadol on 03/02/2010 10:43pm
ultram tramadol
-
actonel on 03/02/2010 10:43pm
actonel
-
aciphex on 03/02/2010 10:43pm
aciphex
-
wellbutrin on 03/02/2010 10:43pm
wellbutrin
-
wellbutrin sr on 03/02/2010 10:44pm
wellbutrin sr
-
lortab on 04/02/2010 11:23am
lortab
-
clomid on 04/02/2010 11:23am
clomid
-
dostinex on 04/02/2010 11:24am
dostinex
-
motrin on 04/02/2010 11:24am
motrin
-
coq10 on 04/02/2010 11:24am
coq10
-
order phentermine on 04/02/2010 11:24am
order phentermine
-
buy carisoprodol on 04/02/2010 11:24am
buy carisoprodol
-
cheap viagra online on 04/02/2010 11:24am
cheap viagra online
-
cheap viagra online on 04/02/2010 11:24am
cheap viagra online
-
advil on 04/02/2010 11:24am
advil
-
fstykltz on 04/02/2010 6:01pm
fstykltz
-
bupropion on 05/02/2010 12:14pm
bupropion
-
minocycline on 05/02/2010 12:15pm
minocycline
-
minocycline on 05/02/2010 12:15pm
minocycline
-
cialis prescription on 05/02/2010 12:15pm
cialis prescription
-
differin on 05/02/2010 12:15pm
differin
-
femara on 05/02/2010 12:15pm
femara
-
omeprazole on 05/02/2010 12:15pm
omeprazole
-
aricept on 05/02/2010 12:15pm
aricept
-
artane on 05/02/2010 12:15pm
artane
-
diclofenac on 05/02/2010 12:15pm
diclofenac
-
nlehuiux on 05/02/2010 7:07pm
nlehuiux
-
cardura on 07/02/2010 1:29pm
cardura
-
cialis prescription on 07/02/2010 1:29pm
cialis prescription
-
artane on 07/02/2010 1:29pm
artane
-
artane on 07/02/2010 1:30pm
artane
-
cheap viagra online on 07/02/2010 1:30pm
cheap viagra online
-
buy viagra online on 07/02/2010 1:30pm
buy viagra online
-
buy ambien online on 07/02/2010 1:30pm
buy ambien online
-
avandia on 07/02/2010 1:30pm
avandia
-
paxil on 07/02/2010 1:30pm
paxil
-
cheap xanax on 07/02/2010 1:30pm
cheap xanax
-
Website Development on 25/05/2010 4:45pm
In Tech News, they talk about PayPal’ s decision to block visitors using old Web browsers, speculate on addition of New York Times news stories to Google Earth, and check out some new web applications for Facebook. Finally, Help News has tips on evaluating the effectiveness of your web site, as well as announcements about upcoming brownbag lunchs and workshops.
Post your comment
Comments
-
Hunt,
In VS2008, you need to open the solution explorer, select the root node in the project, then select the second icon along the top, which is 'show all files'. This will display [grayed out] files and folders which are in the project folder but aren't included in the project config.
Once you see the bin, obj, edit etc, you can select them and add to project.
I'm not ure why they are excluded in the .csproj file, but adding them is fairly stratightforward.
this may also account for Gus's problem, as the N2.dll and other compiled references were in the bin on my sample, which was not included in the project, hence requiring adding them to the project.
Hope this helps...
Ed/Posted by Ed Nice, 27/10/2009 4:48pm (9 months ago)
-
Edit folder does not exist in sources/examples/mvc/wwwroot :(
Next, click on the 'show all files' icon in the solution explorer, then right click on 'edit', 'bin' and 'obj' respectively and 'select add to project for each'. This will take a few minuPosted by Hunt, 24/10/2009 10:06pm (9 months ago)
-
And (I was planning adding this soon anyway) if you download the full source, unpack to somewhere on your P.C., then open sources\src\N2.Templates.Mvc\N2.Templates.Mvc.csproj in VS2008, because it uses the SQLLite file based DB, it'll just compile, run (in the VS dev server), and let you have a play and get to understand the structure and requirements a little before going through the frustration on trying to simulate your normal dev/prod environments as I did.
Hope this helps.
Ed.Posted by Ed Nice, 23/10/2009 4:42pm (9 months ago)
-
Hi Gus,
At which point in the install are you getting the error?
Also, do you have a filename and line number? (If you are getting namaspace errors, it's likely that you'll be seeing this in a lot of files?).
Ed.
Posted by Ed Nice, 23/10/2009 4:35pm (9 months ago)
-
I am getting errors on the N2 library reference,
The type or namespace name 'N2' could not be found (are you missing a using directive or an assembly reference?)Posted by Gus, 21/10/2009 5:29pm (9 months ago)
RSS feed for comments on this page | RSS feed for all comments
Tag Cloud
.net accessibility add ons adwords ajax asp asp.net b2b blog blogs bookmark bots browse browser browsers c# clients client side cloud computing cms collaborative config content management content management system cross browser cross browser issues css design designing development development tips ecommerce favourites froogle google hackers how-to ie ie6 ie8 intellectual property internet explorer ip javascript keywords killer apps layout managing expectations markup mashup microsoft mvc n2 cms networking new ideas objectivity oen source office applications open source page rankings partnerships ppc prototype robots search engines seo social networking soft software source source code spam spiders thin client tips tools tricks twitter useful vulnerability wai wave web web2.0 web design web development web site creation web sites web tools xml
Browse by Date
Subscribe via RSS
Follow us on...
N-WebDesign news
- Visual Studio 2010 & .NET 4.0
- 22/10/2009
- Windows Seven
- 20/10/2009
- Web Design Portfolio
- 19/10/2009
- You can now follow us on Twitter
- 02/10/2009
- Visit our Facebook page
- 22/09/2009



