Archive

Posts Tagged ‘Configuration’

Large file uploads in ASP.NET

Monday, 28 April, 2008 4 comments

Large file uploads in ASP.NET

Uploading files via the FileUpload control gets tricky with big files. The default maximum filesize is 4MB – this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they’ll get an error message: “Maximum request length exceeded.”

Read more…

Categories: ASP.NET 2.0 Tags: , ,

Get data from web.config

Thursday, 24 April, 2008 2 comments

Any data
——————————————————
store:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="admins" value="esetov_b, lobanov_v"/>
</appSettings>
...

get:
string admins = ConfigurationManager.AppSettings["Admins"];

Connection String
——————————————————
store
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ASPGConnectionString" connectionString="Data Source=DS;Initial Catalog=basename;Persist Security Info=True;User ID=user;Password=psw"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
...

get
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["ASPGConnectionString"].ConnectionString);