ASP.NET FAQ - Config files

How can the username and password been created from login control?

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
What is the best place to store Database connection string?

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

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

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
Can I use IIS as an alternative way of configuring Custom error pages

Yes, you can. But the preferable way would be ASP.NET, as the ASP.NET custom pages are configured in XML based web.config (application configuration) file, resulting in easy (xcopy) deployment and management.

Permalink
My web.config gives error ‘Unrecognized attribute ‘verb’.’

Probably you have mispelled the attribute. It should be verbs not verb

Permalink