Tuesday, May 27, 2008

File Upload Limit in ASP.NET

Using ASP.NET fileupload control one can upload by default size upto size of 4 MB which is mentioned in machine.config. I overrided it in web.config and I was able to upload file with size as mentioned by maxrequestlength property. (20480 ≈ 20 MB)

<system.web>
<httpruntime maxrequestlength="20480" executiontimeout="240">
</system.web>

Friday, May 16, 2008

Enable SQL Authentication for MS SQL 2005 Server

In Order to enable SQL authentication for MS SQL 2005 server, I did the following steps

1. Open SQL Server 2005 Surface area configurator and opened Surface area configuration for services and connection. Under database engine, remote connections I enabled Local and Remote connections.

2. In SQl management studio I logged in to SQL server on localhost and right clicked on properties and went into security tab and enabled both Windows and SQL Authentication.

3. Later under the localhost node in management studio, clicked on security\logins folder and created new login using right click.

4. In case the account you created is disabled, make new query as follows (where login name is 'sa')

ALTER LOGIN sa ENABLE
GO

Friday, May 09, 2008

Load ASP.NET UserControl programatically

In order to load UserControl programatically into view control of Multiview control of ASP.NET, I wrote the following piece of code

ViewName.Controls.Add(LoadControl("~/UserControlName.ascx"));