Friday, April 24, 2009

Find the Node having none attribute using C#

Today, I need to search node having none attributes from xml file.

For this, We need to use below XPath query in SelectNodes of the XMLDocument object.

XMLNodeList list = doc.SelectNodes(@"parenttag/child1/child11[not(@*)]");

returns the child11 having none attributes.

Wednesday, April 22, 2009

For ASP.NET, WebApplication to WebSite

Hey!! Guys. Today We have the requirement to convert ASP.NET Application into ASP.NET Web site.

For this conversion we need to follow the below steps
1. Open the ASP.NET Web Application folder
2. Delete all *.designer.cs files.
3. Delete all *.csproj files.
4. Delete all *.csproj.user files.
5. Delete "Bin","obj" and "Properties" Folders.
6. Now open the solution
7. Remove the reference of  ASP.NET Web Application.
8. Add the existing site and give the reference of the folder (ASP.NET Web Application). Now it is became the ASP.NET Web site.
9. If there are any standalone ".cs" file then move those files into "App_Code" folder (If it does not exist then create it).
10. In All *.aspx file, change the attribute "CodeBehind" to "CodeFile" in "Page" directive.
11. Build the ASP.NET Web Site.


Let me know if you will face any problem during conversion process.