Malaika Consultants LLC

Why does my full-text search index goes empty for no reason?

by Swanand Mokashi 21. February 2012 20:54

I have posted the following to the SQL Server forums as well, but no luck so far Sad smile:

I am using SQL Server full text search with SQL 2008. The database we use is mostly read-only. It is updated by an external process on a weekly basis. The database has 4 tables on which full text index has been defined. I am only using the CONTAINS clause in my SQL to utilize the full text search, Nothing fancy.

The external process mentioned above, truncates the tables of the database and imports data to them from CSV files. After the external process completes its task, I am rebuilding the search index. This seems to work fine, for after a few minutes of the external process completion, I am able to get search results correctly. However the full text index seems to get empty for some reason after a few hours/days (I have not been able to find any pattern to when it happens). When this happens, I sometimes get either no search results, or partial results. If I manually rebuild the index from SQL Server Management tool, it works fine after that. Again the tables that have the index defined really do not have any data change, but I still have setup a sql server task to rebuild the search index both on the catalog as well as the individual tables. But this has not helped much

A few things I would like to understand:

  1. What is causing the index to be empty (or partially filled)? And how to fix it?
  2. Is there any way to monitor the status of the index to know how much has been rebuild?
  3. The sql server jobs mentioned above : where can I see the history for them?

Please let me know if any other information is needed to help me solve this issue. It has been driving me nuts.

Tags: ,


Step 6: Handling Menus Effectively in ASP.NET

by Jane Thomson 23. August 2011 18:05

After learning few user controls and ASP.NET Master Pages, let us look at how menu handling can be done with ASP.NET. It is really difficult to maintain the website menu of a large website and it also takes more time. A menu is generally stores inside a file in ASP.NET to make its handling easier. The file where the menu is stores is known as web.sitemap file and it is kept under the root directory on the website.

Apart from the menu, ASP.NET also contains three different navigation controls as well.

1.    Sitemap Path

2.    Tree Views

3.    Dynamic Menus

Sitemap is actually an XML file and it can be created like a regular xml file with few special tags. Let us first look at few rules to create the web.sitemap file.

1.    The sitemap file has to have <sitemap> tag that surrounds the file content.

2.    The tag <sitemap> can have only one child node that is <siteMapNode> which actually is for home page.

3.    However, <siteMapNode> can have more than one child nodes which represents web pages of the website.

4.    Each of the <siteMapNode> has at least two basic attributes of page URL and page Title.

5.    A valid web.sitemap file cannot contain a duplicate URL and URL attribute can be left empty as well.

It is important to note again that a sitemap file must be placed under the root folder and the URL attributes must be assigned with the relative path of root folder.

Here is an example of a sitemap file.

<?xml version="1.0" encoding="ISO-8859-1" ?>
  <siteMapNode title="Home" url="/aspnet/providern_home.aspx">
    <siteMapNode title="Article Writing" url="/aspnet/ providern_article_writing.aspx">
      <siteMapNode title="SEO" url="/aspnet/providern_SEO.aspx"/>
      <siteMapNode title="Link Building" url="/aspnet/providern_link_building.aspx"/>

It is also possible to use more than one sitemap files in order to portray the navigation structure of the website. For an example, a sitemap file in a root folder can be linked to a child sitemap file by referencing child sitemap file in siteMapNode element of the file.



Step 5: ASP.NET View-State

by Jane Thomson 1. May 2011 23:31

After learning a web form and few of the ASP.NET controls, let us look at one of the prime feature of ASP.Net known as View-State. If you have been as ASP developer, you must know that once you submit the form, all the values from the form are cleared. Now, suppose the server comes up with error! Haah, that’s really a bad situation for user and has to refill all the information on the form, and that’s something you want to avoid as a developer.

ASP.NET View-State feature provides exactly the same. As a user if you find that the value you submitted still remains there even if the server gives an error and you press back button, think blindly that the web page is developed with ASP.NET View-State feature.

Basically, ASP.NET View-State is a method used by the ASP.NET pages to persevere the changes of state of a web form across the postbacks. Actual thing is that the ASP.NET maintains the view-state of your form. View-State defines the value of the web page at the time of submission to server. The current status of the web form is maintained with a hidden element places on each of the page with a form control.

It’s a default setting of ASP.NET to maintain the View-State of ASP.NET. In case, if you do not want to maintain a View-State of a web form, you shall include directive, <%@ Page EnableViewState="false" %> on top of the web form. Or else you can also add the element EnableViewState = “false” to any of the controls on the page.

A developer shall use ASP.NET View-State if he/she wants to achieve one of the below features in web page:

·         Save the form values between postbacks even without saving it in a user profile.

·         Save page control property values defined by a developer.

·         If a developer wants to store the view-state information in any data storage.

For Step 6 please click here.



Step 4: ASP.NET Master Pages

by Jane Thomson 1. May 2011 23:27

ASP.Net Master Pages are one of the recent features added in ASP.Net. This feature allows a user to apply same kind of page layout to all the pages of the web application or a website. A web page which uses the master page is also known as the content page. Previously, there was consistent issue faced by users regarding not to have a feature that allow users to give a consistent look across multiple web pages of a single website. ASP.Net master pages are created to take care of deficiency in .NET.

In a website, you can find number of features same across multiple web pages of a single website such as copyright notices, menus, logos etc. Also, a website has a single layout design. Sometimes, even the control buttons across the web pages remains same. In such condition, Master pages take the control to apply same features across the multiple web pages.

Usually, the master page is differentiated by @Master directive which takes place of the directive @page which is used in the pages which are not the part of master pages. The master directive looks something like below:

<%@ Master Language="VB" %>

The directive @Master can contain almost the same directives which @Control directive can. I.e. below master page directive contains the name of the code file and allocates a class name for the master page.

<%@ Master Language="VB" CodeFile="MasterPageexam.masterexam.vb" Inherits="MasterPageexam" %>

In addition to above elements, @Master directive can also contains the top level HTML elements such as head, html tag, form tag etc. for a web page. I.e. user can use the html table tag and image tag to include table and image in the web page. User is allowed to use all the elements of ASP.NET and HTML as a part of the master page. This means ASP.NET master page is a well organized feature for the ASP.NET users to have same look and feel across multiple web pages with a little effort.


For Step 5 please click here.



Step3: ASP.NET Web User Controls

by Jane Thomson 19. March 2011 01:05

We will learn about new control which is known as web user controls in step 3. Web User controls are the controls which are created and added to the web pages. To create a web user control on the web page is pretty much similar to creating a control for the desktop applications. The user control is ASP.NET is based in the class System.Web.UI.UserControl.

Adding a Web User Control on a web page is pretty simple. You can add user controls from the user Add Controls Windows of ASP.NET and by default they come with the .ascx extension. Instead of having @page directives, ASP.NET user controls contain @control directive which defines the configuration of the user control. The limitation of Web User Control is that they cannot be used stand alone and user must have to add it into the ASP.NET webpage just like other controls. ASP.NET web user control differs from the traditional web user control in a way that they shall have the elements like html, body or form only on the hosting page.

Add Web User Controls to Page

In order to add ASP.NET web user controls to the page, user must have to register it on hosting page. While registering, user has to denote the.ascx file containing web user control, a tag name and a tag prefix.

Once done with registering the control, user has to add the code for putting the control on the host page. In this case, below line of code is useful.

<uc1:links id="links1" runat="server"/>

Just like other controls on the page, you can see that even web user controls contains the property of runat = “server” which defines its dynamic nature on ASP.NET unlike traditional web user controls. If a web user control has the Web Server Control, you can also code a web user control to handle events requested by other child web user controls.

For Step 4 please click here.


Step1: Create a Web Form

by Jane Thomson 1. February 2011 13:05

Just like any other technology, you will also find new terminologies in the ASP.NET as well. For a practical example, the word used to mention the web page is ASP.NET is known as a web form and it is the most important terminology of ASP.NET as it’s a central object in the language of ASP.NET. At a first look, the web forms look just like static HTML pages. However, they also contain .NET specific components in addition to the HTML elements as well as some code which executes on the server’s machine.


Web Forms


Each web form contains a tag <form runat = “server”>, which holds the ASP.NET specific elements in it which makes the page. However, there is no support for multiple forms. The actual structure of a simple web form is given below:


<%@ Page Language="language" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

<script runat="server"> 
… some code …



<html xmlns=""> 
<head runat="server"> 
 <title> Title of the Page</title> 
 <form id="form id" runat="server"> 
   … UI elements… 


In order to programmatically access and change the data, the classs System.Web.UI.Page is being used. It is mandatory to define this class in the code file of a web form. In case, user is not generating a specific code file for a web form (when all the code is written in the file .aspx), the class is still gets generated, it is just that user is not able to see that.


In ASP.NET, wide ranges of UI elements are available to use in a web form which also includes the static HTML code. But, a user shall use the elements for which either values can be generated or changed. Such elements are known as controls in ASP.NET. There are numerous controls available in the ASP.NET as listed below:


  1. Master Pages
  2. Web User Controls
  3. Web Server Controls
  4. HTML Server Controls


We will learn about such controls in the coming chapters.


For Step 2 please click here.


NEVER EVER prefix your stored procedures with sp_ !

by Swanand Mokashi 27. January 2011 03:30

Recently I was doing some code review and saw that one of the developers called a new SQL Server stored procedure sp_GetSomething. I explained to her that it is not a good practice to do so but thought I might write a blog so it is useful to other programmers out there as well.

So why should you not name your stored procedure with sp_? Here is why :

This is from SQL Server Books OnLine (BOL) – search for "Creating a Stored Procedure""

“System Stored Procedures

Many of your administrative activities in Microsoft® SQL Server are performed through a special kind of procedure known as a system stored procedure. System stored procedures are created and stored in the master database and have the sp_ prefix. System stored procedures can be executed from any database without having to qualify the stored procedure name fully using the database name master.

It is strongly recommended that you do not create any stored procedures using sp_ as a prefix. SQL Server always looks for a stored procedure beginning with sp_ in this order:

  1. The stored procedure in the master database.
  2. The stored procedure based on any qualifiers provided (database name or owner).
  3. The stored procedure using dbo as the owner, if one is not specified.

Therefore, although the user-created stored procedure prefixed with sp_ may exist in the current database, the master database is always checked first, even if the stored procedure is qualified with the database name.

Important If any user-created stored procedure has the same name as a system stored procedure, the user-created stored procedure will never be executed.”

See that ? So it has the following disadvantages:

  1. There is a little performance hit since the sql server processor needs to go through the above list before it arrives at your stored procedure
  2. There may be a stored procedure in the master database by the same name as yours and hence your stored procedure will not execute
  3. Say you named your stored procedure something generic like sp_BackupData. Microsoft may choose the same name in their future SQL Server release and then the disadvantage mentioned in #2 above will materialize

As a general guidance give your stored procedures meaningful names and if you have to add a prefix, add the prefix based on the functionality group that the SP belongs to. Example : CUST_GetCustomerDetails. We will cover SQL Server naming conventions in one of the future blog posts

Hopefully this was helpful.

Technorati Tags: ,,

Tags: ,


ASP.NET Caching – A Primer : Part 2 – Partial Page Caching

by Swanand Mokashi 14. January 2011 05:48

In the first part of this series we looked into Output Caching. In this part, we will see the options available with partial page caching. Just like output caching you can cache specific sections of a web page using partial page caching. This is achieved by caching user controls used for building the ASP.NET page.

User Controls are typically designed to be shared across multiple pages to enable reuse of their functionality. To achieve partial page caching, you can use the @OutputCache directive : using its default attributes will enable to cache the user control on a per page basis. By setting the Shared = “true” attribute, you can share the user controls among multiple pages. This leads to memory savings on the server, especially if your web site is made up of large number of pages (it always is, isn’t it ?:))

<%@ OutputCache Duration=”30” VaryByParam=”*” Shared=”true” %>

The above directive tells the .NET framework that a copy of the user control is cache and shared amongst all the pages using it for 30 seconds and to vary the cache by any and all parameters

Tags: , , , , ,


Top Reasons Why a Business Should Outsource ASP Net Services

by Swanand Mokashi 6. January 2011 20:08

Businesses today are almost all based online using the Internet and computer technology. This means that companies have had to develop web sites to promote one’s products and services. The business world and all the various industries are always changing which can impact business enterprises and their products and services. If this happens, it may require a web site to be redeveloped in order to meet the growing and changing demands of the industry.

Designing a web site requires specific skill and knowledge. In particular it is important to know ASP Net. This is an application framework used to build web sites, web services, and web applications. It was developed by Microsoft and is used by computer programmers worldwide. Although many online tutorials exist for this web application framework, it may be best for a business to outsource ASP Net services.

Several reasons exist to support why a business should outsource ASP Net services and one of them is the expertise required. Online resources are available to help individuals in creating web sites using ASP Net, but the learning curve can be quite substantial. To create the best web sites one must really comprehend how to use this web application framework. The web applications, services, and sites are quite different when comparing those created by experts and those of novice individuals. It is important for businesses to have the best web site possible because they are competing for customers. Customers will use the company who has the best web site. Therefore, it is a good idea to outsource ASP Net services.

Time is another reason to outsource ASP Net services. A company who has to have employees go through the online tutorials for ASP Net is wasting a lot of time. This valuable time could be spent on other business matters which will bring in revenue. Also, it is likely that in the time it takes to learn how to use ASP Net the web site could have already been created if the company had decided to outsource the service.

A company who decides to outsource ASP Net services will have more time to focus and dedicate towards the business. This focus can lead to substantial increases in revenue because the employees have the time to commit towards their products and services thus resulting in better customer service.

Several reasons exist as to why a company should outsource ASP Net services. These reasons all result in higher efficiency and effectiveness.


Installing WordPress on a IIS Windows box the easy way

by Swanand Mokashi 8. December 2010 01:42

So do you want to install WordPress on your Windows (server or otherwise) ? The usual steps are to :

  1. Install PHP
  2. Install MySql
  3. Install WordPress bits
  4. Pray all of the above works

You would ordinarily go to the various websites to get the PHP , MySql and WordPress bits. However there is a better way and surprisingly it is from Microsoft !! Microsoft “supports” WordPress – this is a no brainer for Microsoft really, WordPress is the most popular blog writing /Content Management system. It is written in PHP and uses MySql and is free and all of this works great on Windows. So it is just an additional revenue option for Microsoft in my humble opinion, to get the WordPress folks to use Windows Servers.

To that effect, Microsoft has been nice enough to create a “web installer” for WordPress. Just go to : and click “Install Now” and it will go through all the above steps (may be not the “pray” step :)) and you will have a website that is running WordPress ! Easy, ain’t it? The best of both the world – open source software (WordPress, PHP, MySql) and nice easy and simple install package from Microsoft.

Tags: , ,


::: | © Malaika Consultants LLC | :::

Malaika Consultants LLC

Malaika Consultants LLC is a custom software development consulting firm located in Cary (Raleigh Durham Research Triangle AKA RTP area ) North Carolina. We offer our expert consulting services in the Microsoft .NET and related technologies. Our mission is to partner with you and ensure the success of your project. We have a team in the USA that will help you with your Information Technology needs and we strive to be truly "Your Information Technology Angels"

We are offering 1 hour of free consulting -- ASP.NET, SQL Server, IIS, anything. Contact us to get your free consulting

Recent Comments