Wednesday, January 5, 2011

How to give permissions to write to the App_Data folder

If you get an error when trying to write programatically to the App_Data folder, that means the web application doesn't have the rights to write on it.
To resolve the issue, you should grant Full Control permission to ASPNET, NETWORK SERVICE and Internet Guest Account system accounts over App_Data folder:

1. In Windows Explorer, go to the folder, right-click on App_Data folder and choose Properties:


2. In General tab, make sure "Read-only" option is not set:


3. In Security tab, gran "Full Control" permission to ASPNET, NETWORK SERVICE and Internet Guest Account accounts:


4. Click OK. Now, ASP.NET should have enough permissions to read/write files and folders in the App_Data folder.

How to register ASP.NET on IIS after installing the .NET Framework

If you install the .NET Framework on a system that has IIS already installed, IIS is automatically configured to handle requests to ASP.NET pages.
If for some reason is not installed, there is a tool that can do the job for you.
The utility is aspnet_regiis.exe, it is located under %WindowsDir%\Microsoft.NET\Framework\vx.y.zzzz\ and you should call it with the -i parameter in the command window, as showed below:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i





Scroll bars in a asp .net datagrid control

There is a way to add scroll bars to a datadrig without using DIV tags, the solution is very simple, all you have to do is to put your grid inside of a panel control and set the ScrollBars attributes to "Both", see the code below:

<asp:Panel ID="pn_orders" runat="server" ScrollBars="Both" Height="350" Width="500">
                    <asp:GridView ID="dgOrders" runat="server">
                    </asp:GridView>
                </asp:Panel>


If you rather to use DIV tags, there is a great web site where you can find a simple example:
http://www.dnzone.com

How to get directory of App_Data in ASP .NET

To get the full path of the App_Data directory of your application use the next code:

 string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"App_data");

Wednesday, December 22, 2010

Sony DVD Architect Studio 3.0 Prepare Folder Error

If you are unable to create the DVD in Sony Architect Studio 3.0 and you get the error:
'The selected folder is not valid. It is either not possible to create the folder or you do not have write access.'

Looks like you are using Windows Vista or Windows 7.

To solve the problem:
  • Rigth click on the short cut of Sony Architect
  • From the menu select "Run as administrator"
  • Try to make the movie again
  • You should be now able to create the DVD in the specified folder

Tuesday, December 21, 2010

How to create a GUID in C#

GUID (Globally unique identifier) is a 128-bit integer that can be used to uniquely identify something.
You may store users or products in your database and you want somehow uniquely identify each row in the database.
A common approach is to create a autoincrementing integer, another way would be to create a GUID for your products.
The GUID method can be found in the System namespace. The GUID method System.Guid.NewGuid() initializes a new instance of the GUID class.


Response.Write(@"
System.Guid.NewGuid().ToString() = " + System.Guid.NewGuid().ToString());


Response.Write(@"
System.Guid.NewGuid().ToString(""N"") = " + System.Guid.NewGuid().ToString("N"));

Response.Write(@"
System.Guid.NewGuid().ToString(""D"") = " + System.Guid.NewGuid().ToString("D"));

Response.Write(@"
System.Guid.NewGuid().ToString(""B"") = " + System.Guid.NewGuid().ToString("B"));

Response.Write(@"
System.Guid.NewGuid().ToString(""P"") = " + System.Guid.NewGuid().ToString("P"));

Monday, December 20, 2010

The connection [ip] requires the use of the SonicWALL Adapter, error

If you get the error when using SonicWALL VPN:
The connection "ip address" requires the use of the SonicWALL Adapter, however this adapter can not be found. Itmay have been disabled or uninstalled. Please check your network configuration."

This is What you need to do in order to fix it:
  •  Control Panel >> Network Connections
  • Right click on SonicWALL Virtual Adapter
  • Select Enable
  • Try to connect again, you should be able to connect now