Code Project

Link Unit

Saturday, December 13, 2008

AJAX Error: 'Sys' is undefined

The error means that you're not getting the client side files loaded on your browser

So I ran fiddler to see what is happening and which file is not getting download.

After struggling to solve the error , this is what saved the day for me.

Web.Config: Make sure your web.config is correctly configured to handle AJAX enabled request. You might have created a project which was not AJAX enabled earlier and now you want to Ajaxfy. The best solution is creating a new project ASP.NET AJAX Enabled Web Site. It will create a Web.config file by default.

Or You can change Web.Config to add following

<add verb="GET"

Wednesday, September 24, 2008

"Page Cannot be found" when browsing aspx pages in Windows 2003

"Page Cannot be found" when browsing aspx pages in Windows 2003

One of my colleague was facing the issue . This is how we resolved it. Hope it helps you also.
You may get a Page cannot be found message when you browse aspx pages in a Windows Server 2003 environment.

That is because in Windows 2003, all the webservice extensions are "Prohibited" by default to ensure security.

To resolve this, do the following steps:-

Step A)
Click on start then select Run. Copy and paste this command then click okay. That will reregister ASP.NET to IIS 
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

Step B)
1. From your Run command, type inetmgr and press enter.
2. Expand the appropriate nodes in the IIS to locate the "Webservice Extensions" Node
3. Click on the same.
4. You will find a list of "prohibited" extensions in the right.
5. Click on ASP.NET and "allow" it

That should resolve this issue.


Friday, June 27, 2008

An attempt to attach an auto-named database for file failed. A database with the same name exists, or specified file cannot be opened, or it is locate

I was implementing the sample given at this site and encountered the issue.
An attempt to attach an auto-named database for file c:\.....\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
The solution for which is as follows:
we have to add following few lines to the web.config file as below:

"User Instance=True;"
Once I added this option to the Connection String everything works fine. So the new connectionstrings look like this.

<remove name="LocalSqlServer">
<add name="LocalSqlServer" providername="System.Data.SqlClient" connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=DataDirectory\ASPNETDB.MDF;user instance=true;Integrated Security=True;Initial Catalog=ASPNETDB;">

I hope this helps the visitors.

Tuesday, June 03, 2008

Using DBMS_METADATA.GET_DDL to generate the table script

I was using Oracle 10g where it required to get the Scripts of all the tables.
While searching google I ended up with DBMS_METADATA.GET_DDL

SELECT DBMS_METADATA.GET_DDL ('TABLE',tname)';' FROM tab where tabtype='TABLE'

I hope this help the visitors.

Monday, May 19, 2008

ASP.Net Server Unable to assign port

I was facing this problem(ASP.Net Server Unable to assign port) way back when I started using Visual Studio . After googling around for a while this is what solved the issue for me.
I hope this help you as well.
If you want to assign a fixed port number for debugging, please refer to the following steps:
1. Right click the Project in the Solution Explorer, and then select “Properties” 2. Click “Web” tab. 3. Check “Specific port” instead of “Auto-assign Port”.
If you want to debug with IIS, please follow the first and second steps above, and then check “Use IIS Web Server” instead of “Use Visual Studio Development Server”. Also, click the “Create Virtual Directory” button.
Please note the above steps are based on Web Application project. For the Web Site project, we can fix the port number by following steps:
1. Click the project in Solution Explorer. 2. Open “Properties” panel. 3. Set “Use dynamic ports” property to false and assign a value to "Port number".
You may also like to follow the excellent description given at following link
I hope this help you as well.

Tuesday, March 18, 2008

Method Error : 12030

While I was trying to make this sample work
The following error appeared
1) Method Error 12030
2) Method Error 12031
3) Method Error 500
How I solved it??
1) Specify [System.Web.Script.Services.ScriptService()] before Class defination in Web Service.
[WebService(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class CarData : WebService
2) Check the name of method is correct as it is defined in Web Service and specified in Cascadedropdown.
3) Install Fiddler program. . It is an excellent Http Debugger.
Hope this help fellow visitors

Sunday, March 09, 2008

Using SQL Server to get Calendar

I was going through this excellent blog and seen the method used by the author Pinal Dave. I tried to do the same using another method. Hope visitors like it.

Create a sequence Table

Select identity(int,1,1) seq into Numbers from sysobjects s , sysobjects so

declare @d datetime

declare @d1 datetime

Set @d1=getdate()-10

set @d= dateadd(d,-day(@d1) + 1,@d1 )

Select @d
Select Isnull(Convert(varchar(12),Min(Case When datepart(dw,@d+N.seq-1)=1 then @d+N.seq-1 else null end),106),'') Monday,

Isnull(Convert(varchar(12),Min(Case When datepart(dw,@d+N.seq-1)=2 then @d+N.seq-1 else null end),106),'')Tuesday,

Isnull(Convert(varchar(12),Min(Case When datepart(dw,@d+N.seq-1)=3 then @d+N.seq-1 else null end),106),'') Wednesday,

Isnull(Convert(varchar(12),Min(Case When datepart(dw,@d+N.seq-1)=4 then @d+N.seq-1 else null end),106),'') Thursday,

Isnull(Convert(varchar(12),Min(Case When datepart(dw,@d+N.seq-1)=5 then @d+N.seq-1 else null end),106),'') Friday,

Isnull(Convert(varchar(12),Min(Case When datepart(dw,@d+N.seq-1)=6 then @d+N.seq-1 else null end),106),'') Saturday,

Isnull(Convert(varchar(12),Min(Case When datepart(dw,@d+N.seq-1)=7 then @d+N.seq-1 else null end),106),'') Sunday

From Numbers N where seq between 1 and 31 and month(@d+N.seq-1) = month(@d)

Group by DatePart(wk,@d+N.seq-1)

Tuesday, March 04, 2008

Parser Error Message: Could not load file or assembly;System.Web.Extensions

Parser Error Message: Could not load file or assembly;System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; or one of its dependencies. The system cannot find the file specified.
I was facing this problem ,while installing prototype of a web application . Searched through the net and figured out that Ajax was not installed. following steps solved my issue.
  1. Downloaded the ajax from
  2. In the project I added a reference to System.Web.Extensions and System.Web.Extensions.Design

I hope this also helps you.

Saturday, February 16, 2008

Speed Up ASP.Net Implementation

While looking for some documents to speed up the .Net implementation . I found the following

Friday, January 11, 2008

Error : ORA-12154

Please note that before trying to solve this error user must be aware that

For a database name to be recognized, it must be resolved by Oracle Client. To resolve a name, Oracle client uses either a TNSNames.ora, A Directory Server or an Oracle Names Server. So this name has to be entered into the TNSNAMES.ORA at a minimum to make this work.

Normally ORA-12154 tnsnames issues arise out of multiple homes, incorrect entries made somewhere in the file tnsnames.ora . So make sure all the entries are correct.

I was also facing the same problem when i create the DB Link as



This is basically the problem with the TNSNAME.ora file, the 'Using' clause not able to find the service name in the TNSNAMES.ora

This is how i solved: I just copy paste the TestService`s Description part as


alter system set global_names=false
(ADDRESS = (PROTOCOL = TCP)(HOST = TestHost)(PORT = 1521))
(SERVICE_NAME = TestService)
here my destination server host is TestHost & service name is TestService .

NOTE: If I had set the "GLOBAL_NAME" parameter to "TRUE", then the DBLink name need to be same as that of DBName .

C# Coding Standard

While searching google for C# Coding Standard I end up with this

See if these can help you