ASP.NET FAQ - Config files

Find answers for the most frequently asked questions
Expand All Collapse All

Drag and Drop the Login Control VS.NET toolbar under Login , change the form name to ‘Login.aspx’.

In the web.config file:

Add the codings given below

<authentication mode='Forms'>
	<forms loginUrl='Login.aspx' protection='All'>
		<credentials passwordFormat='Clear'>
			<user name='Admin' password='Admin'/>
			<user name='Super' password='Super'/>
			<user name='User' password='User'/>
		</credentials>
	</forms>
</authentication>

When the user name and corresponding password mentioned above are given , then the login operation will be completed successfully.

Permalink

In Web.Config, you would add a key to the AppSettings Section:


<appSettings> 
<add key='MyDBConnection' value='server=<ServerName>;uid=<Username>;pwd=;database=<DBName>' />
</appSettings>

Example :


<add key='ConnectionString' value= 'Server=localhost;uid=sa;pwd=;database=northwind' />

Then, in your ASP.Net application – just refer to it like this:


Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings('ConnectionString'))
Permalink

Share with

Couldn't find the FAQs you're looking for?

Please submit your question and answer.