Web.config Tutorial
http://www.csharpfriends.com
World's Greatest C# Community    
Home Articles C# Forums Books C# Syntax C# Spec C# Jobs free Source Code Advertise About
 

Control Panel

[ Sign In / register ]
Points   
Notes 
My Forums
My Tutorials
My Profile

Resources

Learn
 Articles
 QuickStarts
 C# Spec
 Whitepapers
 Tools
 Class Browser
 C# Code Generator
 Links
 Misc Rss Feeds
 Code Highlight
 411 Directory
 FREE magazines
 freevb.net

Reviews
  ASP.NET Hosting

Source Code
 Get Version 1.0



C# Consulting
AspDotNetStoreFront
Chapter:   UnCategorized
Current Lesson:
Web.config Tutorial
[Latest Content]
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | ALL
[prev. Lesson]  Method Overloading [next Lesson]  Cryptography
Web.config Tutorial
  by: Gsuttie

Web.config Tutorial

by: Gsuttie

Use the appSettings part of the Web.Config to store connection strings. This xml can then be modified anytime later and the next time a user browses to the site it will pick this new setting up.

One connection string is to Oracle and the Other is to SQL server
<appSettings>
    <add key="ORACLEConnectionString" value="Provider=OraOLEDB.Oracle.1;
Persist Security Info=False;Password=blah;User ID=greg;Data Source=sph;" />
    <add key="SQLConnectionString" value="data source=SQL1;initial catalog=ID_V;
integrated security=SSPI;persist security info=False;workstation id=TH03D374;
packet size=4096"/>   
<appSettings>
To get the values of the connections trings you would use
string conn = ConfigurationSettings.AppSettings["ORACLEConnectionString"];
OleDbConnection myConnection = new OleDbConnection(conn);
When the site goes live change the debug setting to false which will make the site have a little better performance.
<compilation defaultLanguage="C#" debug="true" />
Customer errors can be handled be turned off but I prefer them to be turned on as below.
<customErrors mode="Off" />
Or
<customErrors defaultRedirect="ErrorPage.aspx" mode="On">   
    <error statusCode="500" redirect="servererror.aspx" />
    <error statusCode="404" redirect="filenotfound.aspx" />
    <error statusCode="403" redirect="AccessDenied.aspx" /> 
</customErrors>
Application Tracing can be set up while shows the output times and all sorts of info of every page if you set it the values to true below. Local only would mean only onthe webserver hosting the site. You can also do per page tracing so that you can turn off application Tracing and have trace="true" at the top of a single page.
<trace enabled="true" requestLimit="10" pageOutput="true" traceMode="SortByTime" 
     localOnly="true"/>

1 


Build Your Own ASP.NET Website Using C# & VB.NET

Chapter:  UnCategorized
Current Lesson:
Web.config Tutorial
[Latest Content]
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | ALL
[prev. Lesson]  Method Overloading [next Lesson]  Cryptography


Today's Top Movers
vulpes 6800
MadHatter 2220
jal 867
Jeff1203 857
muster 791

Yesterday Top Movers
shakti sin.. 9
MadHatter 3
C#fanatic 2
Al_Pennywo.. 2
GazzaJ 1

Monthly Leaders
vulpes 6800
MadHatter 2260
jal 867
Jeff1203 857
muster 791

Top Members
mosessaur 18457
Rincewind 7074
stanleytan 6995
vulpes 6800
Gsuttie 6046

Great Offers
.net hosting
Go To My Pc
Remote Pc Control
zonealarm
spam blocker
web hosting directory
ad server   C#
snadtech GoToMyPc

Top of Page

Advertise | About | Link To Us | Privacy Notice Copyright © 2003 - 2005 CSharpFriends.com  All Rights Reserved  Visual C# Developer Center