Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 14th, 2012, 11:36 PM
Authorized User
 
Join Date: Mar 2012
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default LocalSQLServer in Development Mode vs Live on a Web Host

Hi Imar,

I am just coming to the end of Chapter 16 and at this point I have no issues regarding understanding what is going on. That said however, a question has been raised in my mind when I consider what I need to use when developing a site and running a site live with my web host.

My own web host does not allow me to define my own database names and therefore the ASPNETDB catalog will be called something else. This means that depending whether I am developing the site on my own machine or running the site with my web host I will need differently configured web.config files with the correct connection information.

I realise that I can simply copy saved web.config_Development or web.config_Live files to the web.config file but my question is, is there a specific ASP.NET way to overcome this issue or is there a more convenient/efficient way to overcome this issue of needing differently configured web.config files?

Thanks for any help you may be able to provide.

Kind regards,

Ian Ryder
 
Old May 15th, 2012, 02:17 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Ian,

Unfortunately, there is no easy solution for web site projects. You can indeed maintain two copies, or never overwrite the live version and manually update other settings. Alternatively, and that's what I would suggest in this case, you can use the configSource attribute of the connection string element. This enables you to define the code for the connectionStrings element in a separate file. This way your main config file can be deployed while you should never overwrite the file with the connection strings (which remains a risk). Check out the section "Using External Configuration Files" in this article: http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx

For Web Application Projects, Microsoft created a much better solution: web config transformations: http://blogs.msdn.com/b/webdevtools/...formation.aspx
Unfortunately, this is not available for web site projects, the project type that the Planet Wrox site uses.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 15th, 2012, 03:55 AM
Authorized User
 
Join Date: Mar 2012
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default

Hi Imar,

Thanks for the information. I suspected that this would be the case but its good to know either way.

Talk to you again soon.

Cheers,

Ian





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Make Live Broadcast on the web page vivek.talkin ASP.NET 3.5 Professionals 1 December 1st, 2009 03:07 AM
How to Make Live Broadcast on the web page vivek.talkin ASP.NET 3.5 Basics 0 November 6th, 2009 09:08 AM
JSP Web host ironchef Pro JSP 1 December 3rd, 2007 11:47 PM
How do I host a web application ? nidhinasthra Classic ASP Basics 1 July 6th, 2005 10:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.