Last post Aug 06, 2007 09:30 AM by kranthi_victory
Aug 02, 2007 03:06 PM|kranthi_victory|LINK
How to automatically change environment settings when the application is moved from development server to Integration server. Ex: If the url in development server is
www.dev.pr.com the url must automatically changes to
other url i.e www.int.pr.com when application is moved to integration server. Previously I used to get data from development server, but when my application is moved to integation or production server then it should get
data from prodution server.
Aug 02, 2007 03:43 PM|vb0207|LINK
Is it a web app or a windows app? Which version of .NET? You have to use web.config or app.config to define the environment settings and use that in your code.
Aug 02, 2007 04:04 PM|kranthi_victory|LINK
I am using webapplication.
Aug 02, 2007 04:05 PM|kranthi_victory|LINK
Can you please explain in detail as how to use web.config to define the environment settings.
Aug 02, 2007 04:30 PM|kranthi_victory|LINK
I am using .net 2.0
Aug 03, 2007 05:13 PM|vb0207|LINK
In ASP.NET 2.0, you can add a key in the configuratin / appsettings sections like this-
<add key="myUrl" value="http://www.myUrl.com" />
Then in your code, you can access it like this-
This way, you dont have to re-compile your code if you change the servers. Just have to update web.config.
Search online for "asp.net 2.0 web.config appsettings" or see this article for a detailed example: http://www.jotnow.info/full-Story.aspx?i=39&Story=ASP.NET-2.0%3a-Populating-a-Datalist-using-a-T-SQL-Stored-Procedure--Datalist-Custom-Paging
Aug 03, 2007 05:21 PM|vb0207|LINK
Another way is to use Request.UserHostAddress or Request.UserHostName. This will give the server's ip address or host name.
Aug 06, 2007 09:30 AM|kranthi_victory|LINK