Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Multiple Websites

Status
Not open for further replies.

ttnewbie1234

Programmer
Aug 18, 2009
2
US
Hello everyone! I am new to visual studio 2008 and asp.net websites so please go easy on me. I am hoping to be able to set this up and I would like some expert advice so I do it in the most efficient way.

I would like to set up many websites with a basic template code in c#. Each website will have a list of unique configurations and a unique mysql database. But the core website design and wording will be the same.


So if the index page says "Welcome to SiteName!" and I change this to "Hello and welcome to SiteName!" I would like to be able to do this one time and have the change take effect on all websites. The SiteName will be a variable that depends on each site's configuration, as an example.

I imagine I will need a configuration file for each website to list these constants like the site name, mysql settings, etc. but is there any way to link all of them in Visual Studio easily? Does anyone have any suggestions or ideas for the best way to set this up? Is there anything within Visual Studio that is made for this situation?
 
Hmm. You cant easily use a configuration file for this as you would need to copy it to each and every site.

You either need all the sites to use the same template and pull it from the same source, or make sure all your sites have access to the same Database server, and have a "Common" Database and a site specific one.

If all the templates are html, then (again if all the sites have access to the same vDir) you could define those once and load them in as required. I think performance could be an issue though.

If you are going to do use anything other than basic html templates I'd go for the first option.

But if your sites are not all hosted in an environment you can control then you cant even garuantee that will work.
 
You can create a "BaseWebSite" that has these common things in it. Then have each of your child sites inherit from the base.
 
sounds like you want a CMS (content management system). there are plenty prepackaged ones on the net.

if you want to customize the content any CMS will do. if you want to customize the HTML I would stay away from ones that use webforms. webforms is anything but customizable.

as for using C# for the base template of html. your mixing up your lanaguages. C# has nothing to do with HTML. HTML is HTML. C# will only drive the backend of processing each request. And C# is just a preference, it could be any language: C#, VB, Ruby, Pyhthon, Java, PERL...

As for easy. this is purely subjective. Personally I find webforms cumbersome and difficult to work with. I much prefer the extensibility and testability of frameworks like Monorail and MS MVC. You get the added bonus of choosing my html engine: AspView, Spark, Brail, NVelocity. this doesn't exist with webforms, you have 1 option WebControls.

However, webforms makes designing a webpage easy if you have no html or programming experience. If you need something right now webforms is ok. If you want something maintainable, testing, and extensible I would look into MS MVC or Castle Monorail.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thanks for the information. What I was hoping to do was create my websites using C# for the backend code using aspx. I just realized though that my hosting company, Dream Host, does not support asp. After a lot of searching it seems like most of the information about asp only shows how to run it on your own computer. How do most people actually publish their websites? Do you just look for specific hosting companies that support asp, or do most people actually run their own server? I guess I should just use php but I like being able to use visual studio and write the code in C#.
 
Most hosting companies will support the .NET framework. You can create your own webserver, but most internet providers won't allow you to host your own server unless you buy a static IP address which will be very costly.
 
there may be some confusion: asp != asp.net. they are completely different. there are a number of hosts for asp.net a simple google search will tell you that.

I'll make one other point. your "server" code doesn't need to stop at the code behind. this is still just a web concern. you can separate the data access and business logic into layers that have no dependencies on asp.net.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top