## Saturday, November 14, 2009

### Biztalk : PartUpdateDisallowedException Exception

When you are going to update any message in Construct shape which is already constructed, then you will receive this type of error. Like you are receiving msg1 and just after this receive shape, you are going to construct this message once more. In this type of situation, you will receive this type of error.

Solution:
To resolve this error,create a new message in orchestration view of same type. And use this new message in new message in construct shape. Same problem can occur when you are sending message to .net assembly too. So make sure when you want to update any message, it must be new.

### Biztalk : tracking database doesn’t have any records about the selected service instance yet

I was getting this error while running my biztalk application. After searching on search engine, I have not received any response. Then I tried to see the host instances are working properly or not. And there I found the actual solution. That my application reunning in a host instance(test) was not running. I start that orchestraion and test my application. Its working fine now. Check your Host Instances working properly in which you have configured your BizTalk application. It will resolve your error.

Regards,
Vijay Modi

### MySql: Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.

To resolve this error, please go into the following location:
C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data

and delete “ib_logfile0″ and “ib_logfile1″.

Then go to Services and start your MySql. It will resolve the error and start you MySql.
Why: According to my search: Open the my.ini file and check the InnoDB variables’s size. When above file exides the mentioned size it will prompt this(“Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.”) error.

Regards,

Vijay Modi

### How to Use C# code in vb project. ?

Today, I was facing a problem to how to use C# code in vb WebProject. I got the solution from the following URL:
http://timheuer.com/blog/archive/2007/02/28/14002.aspx

Regards,
Vijay Modi

### Barcode Specifications

I created an application to generate barcode based on the user inputed data. I have written an application for generating barcode based on “Code 128″. I generated that Borcode based on the following specification.
http://www.spatula.net:8000/proc/barcode/code128.src
You can find all barcode specifications on the following link:
http://www.spatula.net:8000/proc/barcode/index.src

Thanks & Regards,
Vijay Modi

### Validation on User Registration

Mostly we are giving functionality for registration on the website and use the website. And using our registration page, user can register him/her and set the UserName and password whatever he/she want. Here we are inserting some validations on client side and server side for checking the data entered by user is valid or not. However one more validation we require on Server side. This is regarding the UserName. We are providing functionality like user can create any UserName. We are checking on server side that the UserName enetered by User is exist or not. And if userName not exist we are creating that User with the UserName that he/she set on registration page.

However we should set one more validation on this registration page for UserName that the user cannot create UserName with the website domain name. Like if site domain name is “www.testing.com”, then user cannot create UserName, which contains the Domain Name in his UserName. Means user cannot register with UserNmae like ‘testing’, ‘testing123′, ‘123testing123′, ‘123testing’, ect…
This is very important as once user register with these name, he can sent mail to other person using that same ID from the website. So we should add validation on server side that the User cannot register with the UserName which contains domain name.

We should also add validation for some common names too. Like we should add validation on server side that the user cannot register with some common names like “hr”, “info”, “information”, “contacts”. So we should also add these list in our Server Side validation. So that user cannot register with these types of UserName.

Let me know your input for the same.

Thanks & Regards,
Vijay Modi

### Find table from Column Name in an MSSQL Database

From the following query you can find all the tables contains the ‘FirstName’ column.

SELECT
table_name=sysobjects.name,
column_name=syscolumns.name
FROM sysobjects
JOIN syscolumns ON sysobjects.id = syscolumns.id
WHERE sysobjects.xtype=’U’ AND syscolumns.name like ‘FirstName’
ORDER BY sysobjects.name,syscolumns.colid

Regards,
Vijay Modi

## Friday, October 16, 2009

### Barcode Specifications

I created an application to generate barcode based on the user inputed data. I have written an application for generating barcode based on “Code 128″. I generated that Borcode based on the following specification.
http://www.spatula.net:8000/proc/barcode/code128.src
You can find all barcode specifications on the following link:
http://www.spatula.net:8000/proc/barcode/index.src

Thanks & Regards,
Vijay Modi

## Wednesday, July 8, 2009

### BizTalk: Pass an XLANG message or an XLANG message part to a .Net method call as a parameter in Orchestration. / Call .Net assembly to update the XLan

Today, I go through a solution to send XLangMessage to .net assembly from an Orchestration and update it. After update I need it in my Orchestration. For this I have created a project which I think it can help others.

I have created an Orchestration project named “CallNetAssemblyBySendingXLangMessageAndUpdate”. I have added the following simple schema in this project named “Book.xsd”.

Then I have created added an orchestration named “CallAssemblyXLangMessage.odx” in project. In this orchestration I am receiving the Book.xsd type message in receive shape. After this I have added the message assignment shape in the transform shape to update the values of message received of Book.xsd type. In this Construct shape I am creating a new message of Book.xsd type. In this message assignment shape I am calling the .net assembly in which I am updating the message.

I am sending the message in .Net assembly method as XLANGMessage parameter. Before going further I want to explain how I am accepting the message and updating it and return it.

For this I have added a new Class Library Project named “UpdateXLangMessage” in the Solution.

You need to create the Book class of Book.xsd created in Orchestration project by using XSD.exe util. You can create this class by using the following command at Visual Studio Command Prompt:

xsd.exe /c Book.xsd

This will create a Book.cs class. Add this project in class library project UpdateXLangMessage.

Now to receive XLangMessage and update it I have added the following class in this project.

========================================================

using System;
using Microsoft.XLANGs.BaseTypes;
namespace UpdateXLangMessage
{
public class UpdateMessage
{
public static Book UpdateBookMessage(XLANGMessage xlngMsg)
{
//Serialize message into Book Object
Book objBook = (Book)xlngMsg[0].RetrieveAs(typeof(Book));
try
{
//Update Book Object
objBook.Author = "Vijay Modi"
objBook.BookID = "00001"
objBook.BookName = "Biztalk 2006 R2"
objBook.Price = "Free"
objBook.Publisher = "Testing Publisher"
}
catch (XLANGsException xlngEx)
{
throw xlngEx;
}
catch (Exception ex)
{
throw ex;
}
//return book object
return objBook;
}
}
}

=========================================================

Build this class. Assign a Strong Name key to this project and add it in GAC using following command in Visual Studio Command Prompt.

gacutil /i UpdateXLangMessage.dll

Now we are going back to our Orchestration project. In Orchestration project add the reference of the .Net class library project.

Now in our Orchestration’s message assignment shape write the following expression:

//msgBookNew is the new message created of Book.xsd schema type

//msgBook is the message received in receive shape

msgBookNew = UpdateXLangMessage.UpdateMessage.UpdateBookMessage(msgBook);

Add the send shape just below the Transform shape in the orchestration. Assign the msgBookNew message in this send shape. The orchestration will look like as below:

Now deploy your orchestration project and test it. Some important reference I have found on the net are as below:

Regards,
Vijay Modi

## Sunday, July 5, 2009

### Biztalk WSE Web Services Publishing Wizard Unable to load the assembly "…..\BTSTest.dll" [System.IO.FileNotFoundException] File or assembly name......

Error: Biztalk WSE Web Services Publishing Wizard Unable to load the assembly "…..\BTSTest.dll" [System.IO.FileNotFoundException] File or assembly name Microsoft.XMLANGs.BaseTypes, or one of its dependencies, was not found.

Solution:

To resolve this error you need to install the BtsAdpaterForWSE20-SP1 and need to add the ASPNet Users in BizTalk Isolated Host user group.

You can use the Start -> Administrator Tools-> Computer Mangement -> Local Users & Groups -> Group -> Double click on BizTalk Isolated Host Users and add the ASPNet user.

## Wednesday, July 1, 2009

### Could not retrieve transport type data for Receive Location ‘RCVTestLoaction’ from config store. Primary SSO server ‘MYMachine’ failed. Could not ....

Error: Could not retrieve transport type data for Receive Location ‘RCVTestLoaction’ from config store. Primary SSO server ‘MYMachine’ failed. Could not contact the SSO server ‘MYMachine’. Check that SSo is configured and that the SSo service is running on that server.

Solution:

You will receive this error when you have changed password of your local machine. Please note here, when you changes the password of your local machine, it will not set at the SSO’s configuration. Means it will not change the password in the configuration of SSO. So at this time you will receive this type of error. So to resolve this error you need to go to SSO’s configuration and set the new password of local machine. It will resolve your error.

Note: Whenever you change the password of local machine at this time you need to change the password of all Biztalk services including SSO server too.

## Tuesday, June 30, 2009

### How to check xml parameter’s node value is null or empty in MS Sql

Suppose you are receving XML datatype of message in your stored procedure and you need to extract value from
that xml parameter. Before extracting data you need to check the node is exist or not. Means is that node is empty or not.
You can do it by using the .exist() in MS Sql.

Let me explain using an example.

Suppose we have a @XmlDoc and it contains the ‘’ data.
Here in example we are checking is there any Student contains Maths subject. As you can see in our Xml, it is there so it will return 1. Like the
same way we can check the particular node is exist in xml or not. So to check the value, we can use this way.

DECLARE @XmlDoc XML

SET @XmlDoc = ‘
DECLARE @docHandle int

IF (@XmlDoc.exist(‘/Student/Subject/Maths’)=1)
PRINT ‘Maths Exist’
ELSE
PRINT ‘Maths Not Exist’

IF (@XmlDoc.exist(‘/Student/Subject/Science’)=1)
PRINT ‘Scienct Exist’
ELSE
PRINT ‘Science Not Exist’

## Saturday, June 27, 2009

### XML parsing: line 1, character 38, unable to switch the encoding

When you will create an Xml file with the Encoding type UTF-8, they it will give you this error:
“XML parsing: line 1, character 38, unable to switch the encoding”

To resolve this error you need to set the Encoding type to UNICODE i.e. UTF-16. Test it using this encoding type UNICODE / UTF-16, it will resolve your error.

Regards,

Vijay Modi

## Monday, June 22, 2009

### Biztalk : Illegal attempt to update the value of part ‘part’ in XLANG/s message ‘testMsg’ after the message construction was complete.

When you are receiving a message and will go to update it in the expression shape, you will receive this type of error. To resolve this you need to construct the new message of the same type and needs to update the value of it in the construct shape using Message Assignment shape.

Regards,
Vijay Modi

## Thursday, June 18, 2009

### MS SQl + XML parsing error: Reference to undeclared namespace prefix

When a namespace is declared in your xml document / String and you will use the OpenXml in your stored Procedure / Sql Query, you will get this type of error. To remove this error you need to define the namespace while you write the EXECUTE statement in you query/stored procedure.

Suppose you have written the following statement:

EXEC sp_xml_preparedocument @docHandle OUTPUT, @XmlDoc

So you need to change it with the following one:

EXEC sp_xml_preparedocument @docHandle OUTPUT, @XmlDoc, ‘

Where ns0 is the namespace of your xmlDocument, which is defined in the first node of your xml document. Suppose my xml document is as follows:

ID_0
Name_0

City_0

Let me know if you have any query:)

Regards,

Vijay Modi

## Sunday, June 14, 2009

### "Service Unavailable" error message

When you are going to browse your web service or WCF Service, you can get this error “Serviec Unavailable”.

This error may occur if the password of Application pool assigned to Web Service or WCF Service is not correct. So to resolve this one you need to change it. You can change it using the IIS Services.

To change the password of application pool, see the properties of the application pool using IIS Services. and change the password. Restart the IIS using IISReset in Start=>Run.

Test your Web Service or WCF Service, it will work.

Regards,
Vijay Modi

## Wednesday, June 10, 2009

### BizTalk: Dynamically create schema nodes using XSLT

First let us discussed about the problem:I have a source schema which is in the following format:Now I want my destination schema in the following format:Note: Check I want the Ord1 and OrdName1 in OrderInfo as well as Ord2 and OrdName2 in OrderInfo too. So I need the value of above in one record (node) of Destination schema. So for to do the above functionality I have used the BizTalk map. What I have done is I have created a BizTalk map and assign Source.xsd in SourceSchema and Destination.xsd in Destination schema of this map.You can see the snap of my Mapping as follows:Here you can find that I have added just one script Functoids in the mapping of source and destination schema. I have written the following code (XSLT Code) to map both schemas.==========================================================================

##### </xsl:for-each>

==========================================================================So Test the map and check the generated destination file.Enjoy BizTalking:)

## Thursday, June 4, 2009

### Biztalk : Could not load file or assembly ‘Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d

Error: Biztalk : Could not load file or assembly ‘Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified

Solution:

This error will come when you will call .net assembly from BizTalk orchestration using Expression shape or Message Assignment shape. The error telling you that the .Net assembly could not loaded means the .Net assembly is not exist in Globle Assembly Cache(GAC). So you have to put the particular assembly in GAC.

You can keep the assembly in GAC using the GACUtil command. Suppose you have the “Microsoft.Practices.EnterpriseLibrary.Logging” file in “C:\program Files\Microsoft Enterprise Library 3.1 – May 2007\Bin” folder. Open the microsoft Visual Studio Command Prompt. Then change the directory to this path(“C:\program Files\Microsoft Enterprise Library 3.1 – May 2007\Bin” ) and write the following command to put the assembly in GAC:GACUtil i/ Microsoft.Practices.EnterpriseLibrary.Logging.dllIts will install the Microsoft.Practices.EnterpriseLibrary.Logging.dll in GAC.Now restart your BizTalk Service Host and stop and start your BizTalk application. Then test your orchestration. It will resolve your problem.Cheers:)

Regards,
Vijay Modi

### Biztalk : Log entry using Microsoft Practice Enterprise Library in .Net assembly / Call .Net assembly using Biztalk Orchestration Expression Shape……

Its one of the important task in Biztalk to do the Log entry whenever you want in the orchestration. Suppose you have got an error and you need to log it before the Message going in suspended mode. One of the best solution we can use to loggin is the Microsoft Practise Enterprise library. So how will we do it? If you will implement it the first time you will face many problems like how to call .net assembly from an orchestration, configuration etc… So I thought to write an article on this full functionality. I am trying to write here as easy as possible from my side. Please let me know your comments if you have found any mistake in this article.

Important: You need to install the Microsoft Practise Enterprise Library 3.1 in your machine. You can download it from the following link:

First you need to create a .Net class library project using VS .net 2005. Like I am creating a project named ‘TestEntLibLogging’.
Create a class named ‘EntLibraryErrorHandler.cs’ in you project.
Make it public and serializable.
Please create a method named ‘LogErrorbyEntLibrary(Exception ex)’ in the above class.

Now you need to add reference Microsoft.Practices.EnterpriseLibrary.Logging.dll in you project. To add reference in your project just right click on your project and select ‘Add Reference’. And select the ‘Microsoft.Practices.EnterpriseLibrary.Logging.dll’ from list of assembly.

Now add the following library in you class named ‘EntLibraryErrorHandler.cs’:
using Microsoft.Practices.EnterpriseLibrary.Logging;

Now in you method ‘LogErrorbyEntLibrary(Exception ex)’, write the following code to log entry:

======================================================
//Create an object of LogEntry
LogEntry objEntry = new LogEntry();

//Assign properties to LogEntry object.
objEntry.Message = ex.ToString();
objEntry.Priority = 1;
objEntry.TimeStamp = DateTime.Now;

//Do the Log entry.
Logger.Write(objEntry);
========================================================

This code will work perfectly. Now we are going to implement the configuration of the config file using ‘Enterprise Library Configuration’ tool. You can find this too in the Start > Program Files > Microsoft patterns & practices > Enterprise Library 3.1 – May 2007 > Enterprise Library Configuration.

Now open you config file in this by selecting the File Menu > Open.

Now one of the question should come in your mind is which configuration file you need to configure here. Because you have not added any configuration file in you class library project. So the answer is:

You need to configure the ‘BTSNTSvc.exe.config’. You can find this file in your ‘C:\Program Files\Microsoft BizTalk Server 2006′ folder. i.e. where you have install your BizTalk.

So open this configuration file in your Enterprise Library Configuration wizard. Now right click on your config file and add new Logging Application Block by clicking on ‘New > Logging Application Block’.

There select the ‘Tract Listeners’. Right click on it and select the New > Rolling File Trace Listener.

You can select Flat File Trace Listener. Here I am creating Rolling File Trace Listener to creating the File separately for each day.

There see the properties of new added ‘Rolling Flat File Trace Listener’. Select the Formatter and select the ‘Text Formatter’ from the list.
You can update the Template properties inside the Formatter property whatever you want. To chaange the looging file’s path you have to change the property of the FileName. If you want to put the File in C:/Log/rolling.log, then you have to write it in the FileName property.

Now we have created a Rolling File Trace Listener. Now we need to assign it to ‘Formatted EventLog TraceListener’, which is in the ‘Special Sources > Logging Errors & Warnings node’. Select the ‘Formatted EventLog TraceListener’ and in the property window select the Reference Trace Listener to ‘Rolling Flat File Trace Listener’ from the dropdown. You can change the header and footer whatever you want in your logging file.

Now you can find two properties which are very important here. One is the RollFileExistsBehavior and another is RollInterval. The default value of RollFileExistsBehavior has set to OverWrite, which means it will overwrite the existing file. This we need to update to increament. For this just select the dropdown and select increament. This will create a new file based on the interval set there.

The second one is the RollInterval, which is default set to None, means it will not create new file. It will just overwrite the existing file. This we need to set depends on the requirements. I am setting it to Day, means it will daily create a new file for log entry.

Now another property ‘RollSizeKB’, This is one important property if we want to restrict to write in file more than particular size. Like I want to create the logger file not more than 5 kb size. So I will set this property. But for now I don’t require here. But if you want you can set it there.

Now you need to set the ‘Rolling Flat File Trace Listener’ in the ‘Category Sources > General > Formatted EventLog TraceListener’. Just select this node and select the Referenced TraceListener to ‘Rolling Flat File Trace Listener’ from the dropdown.

So your configuration of the config file has been completed now.

Now our remaining part is how to call the .Net assembly (that we have created the .net class library project) from Biztalk orchestration:

I am here write the following code to call the .net assembly from an Expression shape. You need to add the reference in your biztalk project. You have to right click on your biztalk project and select the Add reference. In the add reference wizard, select the Projects tab. There you will find our Class Library project. Select this project and click ok button. So now we have added the Class Library Project’s reference in our BizTalk project. Now you can access all accessible methods in your expression shape.

Write the following sentence in you catch block of the orchestration. Here I expect that you know how to use the catch exception in orchestration. Add an expression shape and write the following sentence to call the method ‘EntLibraryErrorHandler(Exception ex)’.
======================================================
TestEntLibLogging.EntLibraryErrorHandler.LogErrorbyEntLibrary(ex);
//Where ex is the Exception Object Name
======================================================

Note: Now when you run your orchestration you will face a runtime error that the EntLibraryErrorHandler not found. Its reason is that we have not add the Class Library project in GAC. To add the above file in GAC write the following command on Visual Studio Command Prompt:
======================================================
GACUTIL /i EntLibraryErrorHandler.dll
======================================================

Now test your orchestration.
I am first time writing this type of big article on my blog. So there can be some problem. And for time purpose I have not write the steps. But I think you have the initial knowledge of the Biztalk and you can understand it. Let me know if you will have any confusion or query with this article. You can add your comments here.

## Tuesday, June 2, 2009

### BizTalk: Dynamically create schema nodes using XSLT

First let us discussed about the problem:I have a source schema which is in the following format:Now I want my destination schema in the following format:Note: Check I want the Ord1 and OrdName1 in OrderInfo as well as Ord2 and OrdName2 in OrderInfo too. So I need the value of above in one record (node) of Destination schema. So for to do the above functionality I have used the BizTalk map. What I have done is I have created a BizTalk map and assign Source.xsd in SourceSchema and Destination.xsd in Destination schema of this map.You can see the snap of my Mapping as follows:Here you can find that I have added just one script Functoids in the mapping of source and destination schema. I have written the following code (XSLT Code) to map both schemas.==========================================================================

##### </xsl:for-each>

==========================================================================So Test the map and check the generated destination file.Enjoy BizTalking:)

## Saturday, May 30, 2009

### BizTalk: Message Assignment shape. Assign value from one Schema to another Schema.

We can assign one schema to another by many ways. But best way to assign values to one schema from another schema is to use the Message assignment Shape inside the Message Construct shape. Let’s take an example for it.

Example: Conversion of BillingAddress to ShippingAddress. For this I have two Schemas BillingAddress.xsd and ShippingAddress.xsd. All the elements of both schemas are promoted to Distinguished Fields, so that we can access them in message assignment shape. Both schemas are as follows:

Now I have created an orchestration, in which I am assigning the values of BillingAddress.xsd to ShippingAddress.xsd. For this I have created two messages msgBillingAddress and msgShippingAddress of BillingAddress.xsd and ShippingAddress.xsd types respectively. I have created a variable named varXmlDoc of System.Xml.XmlDocument type. My orchestration will look like the follows:

Now the purpose of this article is to share how to assign one message to another one. I have added the following code to assign BillingAddress to ShippingAddress message.

//Create a new object of XMLDocument. For this we will use the Variable created as XMLDocument.

varXmlDoc = new System.Xml.XmlDocument();

//We need to Load the variable with dummy XML.

//It can be same as generated instance.

//Note here we have to assign that instance that we need in target, not the //source schema.

<City>Test City</City>

<State>Test State</State>

<Country>Test Country</Country>

<Zip>00000</Zip>

//Assign XMLDocument varSmlDoc variable to ShippingAddress message.

//Assign data to each element

I think now you can understand how to assign one schema to another schema using Message Assignment shape in BizTalk Orchestration.

Let me know if you have any confusion in this article.

## Tuesday, May 26, 2009

### BizTalk : The configuration section for Logging cannot be found in the configuration source.

You will find this error while you will running / testing your orchestration. The error is telling that the configuration section for logging cannot be found in the configuration source.

So You will go to change your configuration file. I have done the same.

But it will not resolve your problem. The main problem is not in your application's configuration file. But the problem is in the BTSNTSvc.exe.config file, located in your installcation directory. So please enter the logging details in this file. Then test your Orchestration. I am sure it will resolve your problem.Cheers:)

I am adding the following(at 14th August,2008) after getting comments from some friends(E.R. Joell & PeteM). Thanks buddy:

We needs to add the following block in the BTSNTSVC.exe.config file (that you can find in C:/Program Files/Microsoft BizTalk Server 2006) inside the <configSections></configSections>:

======================================================

<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

======================================================

And add the following block just after </ConsigSection>:

======================================================

<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add fileName="C:/log/testrolling.log" rollSizeKB="0" timeStampPattern="yyyy-MM-dd"
rollFileExistsBehavior="Increment" rollInterval="Day" formatter="Text Formatter"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="DateTime, ProcessId" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Rolling Flat File Trace Listener" />
<add listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.SystemDiagnosticsTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="DateTime, ProcessId" type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="System.Diagnostics TraceListener" initializeData="C:/Trace/TestTractListener.log" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}&#xD;&#xA;title: {title}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;priority: {priority}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Text Formatter" />
</formatters>
<categorySources>
<listeners>
<add name="Rolling Flat File" />
</listeners>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors &amp; Warnings">
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>

====================================================

Once more thank to give me a such type of comments so that I can update my articles. I like this.

Regards,
Vijay Modi

## Monday, May 25, 2009

### The application is already precompiled.

You will get this error when you are going to build your Web Service. To resolve this error please first make sure no .keep file exist in you this web service. Please remove all .keep files and also move the PrecompiledApp.config file. Its resolve my problem. I think its the solution of this error.

## Thursday, May 14, 2009

### BizTalk Orchestration: How to assign Called Orchestration property of CallOrchestration shape:

When we have Orchestration in the same project, we can select it directly in Called Orchestration property of the CallOrchestration shape. But when we have called orchestration in reference assembly (Another Project), we need to set the Type Modifier property of that orchestration to Public. By default it is Internal. But to use any orchestration as Referece Assembly in another project for CallOrchestration shape, we need to set its Type Modifier property to public and one more thing that the receive shape of that called orchestration must not Activated(i.e. its Activate property should be False). So an so we can find that orchstration in CallOrchestration's reference assembly else not.

## Saturday, May 9, 2009

### Biztalk : How to comment the Shape used in orchestration?

I am working on Biztalk 2006 R2 and facing a big problem. I have created an orchestration and for temporary purpose I want to comment some shapes that I have used in this orchestration like we are commenting the code in .net. But I have not found any facility in Biztalk to do it. I think microsoft has to add this functionality in this technology. Let me know your reviews, if you want to add.

At this time to resolve this issue, I am using the decide shape and keeping all unwanted shapes in this decide shape which cannot execute. I have added such type of condition which will never true (i.e. 1==0). So at this time I can run my orchestration and can use those commented shapes(insude the above decide shape) in future if I want. Is it ok?

Let me know if you have any new idea.

## Tuesday, May 5, 2009

### ASP.Net + Access to the path 'C:\Inetpub\wwwroot\Test\images\upload\test.jpeg' is denied.

This error is coming when you are going to upload the file on specified folder. Here I am going to upload test.jpeg in upload folder. When I am going to upload I am getting the following error:

Solution:

For this you have to give the access to this folder. Please follow the steps to resolve this error:

1> Right click on upload folder. Click on properties.

2> Click on Security tab. You can find the window like following:

3> Click on Add button. You will find the following window.

4> Write the Everyone in the "Enter the objecdt names to select[Select]:" textarea.

5> Click on Check Name button and click on ok button.

6> Give full control rights to this Everyone user.

Now test your application. It will works fine.

## Friday, May 1, 2009

### Javascript + Replace forward slashes '/' with backward slashes '\'.

Hi friends,

Using following Javascript sysntax you can replace forward slashes ('/') with backward slashes ('\') :
var strReplace = "C:\Temp\Temp1\Temp2\text.jpeg";

strReplace = strReplace.replace(new RegExp(/\\/g),"/");

Regardes,

Vijay

## Tuesday, April 28, 2009

### Developers confused with microsoft products like .Net 3.5 ?

Hi,

Before some days I met my friends and asked microsoft has launched the Visual Studio 2010 with .Net Framework 4.0. I was really very happy to use it. But they (my friends) confused. They told me why microsoft launching new versions quickly. They told me that Microsoft has launched .Net 2.0 in 2005, .Net 3.5 in 2008 and now they have the version in .Net 4.0 2010. Just in distance of two years they have launched three different versions. Even developers have not used the 2.0 properly. May be microsoft has many intelligent software engineers who are developing new versions very quickly. Whatever we are not microsoft. :P

Some one also told me "Microsoft is not solving their problem in their existing product. But launches new version as earlier as others could not find the bugs in earlier version." So I like to ask you are you all now ready to use .net 4.0 2010. I know there are too many features in this version, but ask your self how much do you know about .net 2.0? You can write your comments here.....

Microsoft is very quickly launching new version. Is this good for you or not?

Regards,

Vijay Modi

## Monday, April 20, 2009

### Context Menu on Mouse Right Click for IE, FireFox Mozilla, Safari.

After long time, I like to write an article on JavaScript compatibility on different browsers. In this article I am creating a context menu on mouse right click. As we know we can easily create the context menu using javascript, but the main problem is the browser compatibility with this context menu. I am here giving some code to create a context menu. You can use this in any browser. I tested it in Internet Explorer 6.0, Firefox Mozilla 2.0 and Safari 3.0. It's working fine.

Copy and paste the following code in notepad and save it as TestContextMenu.html and test it.

=============================================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<TITLE>¦¦-Browser Compatible Context Menu-¦¦</TITLE>
<META NAME='Generator' CONTENT='Javascript Context Menu'>
<META NAME='Author' CONTENT='Context Menu on Mouse Right Click'>
<META NAME='Keywords' CONTENT='Browser compatible context menu'>
<META NAME='Description' CONTENT='Internet Explorer IE, FireFox, Safari compatible context menu'>
<style>
<!–
.skin0
{
position:absolute;
width:165px;
border:2px solid black;
background-color:#eeddee;
font-family:Verdana;
line-height:20px;
cursor:default;
font-size:14px;
z-index:100;
visibility:hidden;
}
{
}
–>
</style>
<script language=javascript>
//Following function will fired when we click on the right click menu option.
function getSelText(obj)
{
}
</script>

<BODY><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<CENTER>
<P><B>
<H2>Right Click on the document and select an option from the context menu. <BR>This example is tested in Internet Explorer 6.0, Mozila Firefox 2.0 and Safari 3.0. Its working fine in all these browser.<B> </H2><BR><H1>Hurrey…..</H1>
</P></CENTER>
<div id='ie5menu' class='skin0' onMouseover='highlightie5(event)' onMouseout='lowlightie5(event)' onClick='jumptoie5(event)' display:none>
<div class='menuitems' url='#' onmousedown=getSelText('Copy');>Copy</div>
<div class='menuitems' url='#' onmousedown=getSelText('Cut');>Cut</div>
<div class='menuitems' url='#' onmousedown=getSelText('Paste');>Paste</div>
<div class='menuitems' url='#' onmousedown=getSelText('New');>New</div>
<div class='menuitems' url='#' onmousedown=getSelText('Edit');>Edit</div>
<div class='menuitems' url='#' onmousedown=getSelText('Submit');>Submit</div>
</div>

<script language='JavaScript1.2'>
//set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
var display_url=0

var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
if (ie5||ns6)

{
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX
var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY

//if the horizontal distance isn't enough to accomodate the width of the context menu
//move the horizontal position of the menu to the left by it's width
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? document.body.scrollLeft+event.clientX : window.pageXOffset+e.clientX

//same concept with the vertical position
else
menuobj.style.top=ie5? document.body.scrollTop+event.clientY : window.pageYOffset+e.clientY

return false
}

{
}

function highlightie5(e)
{
var firingobj=ie5? event.srcElement : e.target
{
if (ns6&&firingobj.parentNode.className=='menuitems') firingobj=firingobj.parentNode //up one node
firingobj.style.backgroundColor='#00AAff'
firingobj.style.color='white'
if (display_url==1)
window.status=event.srcElement.url
}
}

function lowlightie5(e)
{
var firingobj=ie5? event.srcElement : e.target
{
{
firingobj=firingobj.parentNode;
}
firingobj.style.backgroundColor='' ;
firingobj.style.color='black' ;
window.status='';
}
}

function jumptoie5(e)
{
var firingobj=ie5? event.srcElement : e.target;
{
if (firingobj.getAttribute('target'))
window.open(firingobj.getAttribute('url'),firingobj.getAttribute('target'));
else
window.location=firingobj.getAttribute('url');
}
}

if (ie5||ns6)
{
}
</script>
</BODY>
</HTML>

==============================================================

Note: I came to know from some comments that the Code is not working. I here note that the code was not working due to the problem with " character. I don't know but it was encrypted. I retype the code here and think that it will work. Let me know if you found any problem. Thank you...
Enjoy this......

Reference: http://www.dynamicdrive.com

## Wednesday, April 15, 2009

### Syntax Difference between MS Sql and My Sql

I got some problem with the guys that they want to know the exact difference between the syntax of MS Sql and My Sql. So I like to write this article on this blog. As you see my articles, I have also write an article for the commercial difference between these two Databases. You can see this article on the following url:

http://vijaymodi.wordpress.com/2007/03/28/my-sql-vs-ms-sql/

Now I like to give the syntax difference between these two databases. Let me start it now...

> If you want to retrieve the first (Top) four rows from a table by using query you have to write TOP in MS Sql. While for the same purpose, you need to write LIMIT in mysql. The syntax are as follows:

MS SQL:
SELECT TOP(4) * FROM TableName ORDER BY FieldName

MY Sql:
SELECT * FROM TableName ORDER BY FieldName LIMIT 4

> My Sql can insert multiple rows at a time, while MS Sql cannot.

MS SQL:
INSERT INTO tablename VALUES (1,'AAA'); INSERT INTO tablename VALUES (2,'BBB'); INSERT INTO tablename VALUES (3,'CCC');

MY SQL:
INSERT INTO tablename VALUES (1,'AAA') , (2,'BBB') , (3,'CCC');

> MSSQL doesn't have CHARACTER_LENGTH. Provides the LEN and DATALENGTH functions instead (the latter is especially valid for 'special' data types like the TEXT type).while MYSQL Provides CHARACTER_LENGTH.
Aliases: CHAR_LENGTH, LENGTH. Note that MySQL removes trailing (not leading) spaces from CHAR values before counting.

To See the other more important difference visit the following link:

http://troels.arvin.dk/db/rdbms/

## Thursday, April 9, 2009

### VS 2008 Beta 2 Silverlight Reference Problems

I have installed VS 2008 Beta 2, Silverlight Alpha Refresh and the Silverlight tools for VS.

Then I have created a SilverLightProject. But when I am going to build this project I am getting the following warnings:

'agclr'
'mscorlib'
'system'
'System.Core'
'system.Xml.core'
'system.silverlight'

I cannot understand why this problem is comming.

I tried on the net. But not getting any solution. Then I tyied the following and solve the problem.

First I Install the "Microsoft Silverlight Tools Alpha for Visual Studio 2008 Beta 2".

Then re open the Visual Studio SilveLightProject, which I was created before. Then tried to build it. Still facing the same problem.

Second I Install the "Microsoft Silverlight 1.1 Alpha".
Then re open the Visual Studio SilveLightProject, which I was created before. Then tried to build it. Its amazing....:) Its working fine now....

Its working now.

I found that before installaton of "Microsoft Silverlight 1.1 Alpha" that, there in "Program Files\Microsoft Silverlight" folder did not contan the above reference dll. So I was getting errors. But after complete this installation, I got these all dll's there and so my problem was solved.

So try like this. Enjoy the SilveLight.:)

Regards,
Vijay Modi

## Thursday, April 2, 2009

### Cannot insert explicit value for identity column in table 'tblTestTable' when IDENTITY_INSERT is set to OFF.

Suppose you have a table in MS Sql with two Columns.
CREATE TABLE [dbo].[tblTest](
[Test_Id] [int] IDENTITY(1,1) NOT NULL,
[Test_Name] [varchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_tblTest] PRIMARY KEY CLUSTERED
(
[Test_Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]

Now you are inserting the three values in this table:
Insert Into tblTest(Test_Name) values("Test1")
Insert Into tblTest(Test_Name) values("Test2")
Insert Into tblTest(Test_Name) values("Test3")

So your table will look like as follows:
1 Test1
2 Test2
3 Test3

Now you are deleting second row of the table using the following syntax:
DELETE From tblTest where Test_Id=2

Now you table will looks like the following:
1 Test1
3 Test3

Now you are going to insert a row with the following query:
Insert Into tblTest(Test_Id,Test_Name) values(2, "TestTemp2")

when you execute this query, you will face the following error:

This error is coming when we have a Identity Specification is 'Yes' and IsIdentity is also 'Yes', Identity Increament is set to(1/2/...).

So you are unable to insert this type of row, because sql know that the Test_Id is the Identity_Column and so you cannot insert the value which already inserted. So to resolve this error, you have to set the Column_Identity ON by using the following syntax.
SET IDENTITY_INSERT tblOrderItemStatus ON

Then try to insert the row using the above same query, which was as following:
Insert Into tblTest(Test_Id,Test_Name) values(2, "TestTemp2")

Now you need to reset the Column_Identity OFF. You can do it just by the following syntax:
SET IDENTITY_INSERT tblOrderItemStatus OFF

Is it resolve your problem. Howdy buddy?....

## Sunday, March 29, 2009

### .Net 3.5 XAMP: {System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0

Today I am trying to work on WPFBrowserApplication. I face the following error. I don't understand how to resolve this problem. I tried on search engine. Then I go to the project's property. There I found in the 'Security' tab that the permission was given are: FileDialogPermission & IsolatedStorageFilePermission. But for this I need FileIOPermission too. So I check radio button 'This is a full trust application'. Then I tried to run the application. And its running very fine. Your security tab should look like the following:

Sometimes problems are too easy then time spent to resolve it.

Vijay Modi

## Thursday, March 26, 2009

### MS Sql Server: Alter Table set default value

Hi Friends,

Do you want to know how to Alter Table for adding new column with Default value? The sysntax of sql server is:

ALTER TABLE table
{
{
column_name data_type [ ( size ) ]
[ DEFAULT value ]
{ [ NULL | NOT NULL ] | [ { PRIMARY KEY | UNIQUE } ] }
{ [ CONSTRAINT constraint_name ] }
}
|
ALTER COLUMN column_name
{
data_type [ ( size ) ] [ ( precision [ , scale ] ) ]
[ NULL | NOT NULL ]
}
|
DROP { COLUMN column_name | [ CONSTRAINT ] constraint_name }
}

table
Specifies which table is to be altered.
column_name
The name of the column being added, altered, or dropped.
data_type
The data type of the column being added or altered.
size
Is the length of the data that can be entered into a field.
DEFAULT value
Is the default value for the column being altered.
NULL | NOT NULL
Is a parameter that indicates whether a column can or cannot contain null values.
PRIMARY KEY
Is a parameter that identifies the column or set of columns whose values uniquely identify each row in a table. Each table can only have one primary key constraint.
UNIQUE
Is a constraint that enforces the uniqueness of the values in a set of columns.
constraint_name
The name of the constraint to be added or dropped.
precision
Specifies the precision for the data type.
scale
Specifies the scale for the data type.
The ALTER TABLE statement can be used to modify an existing table by adding, altering, or dropping columns and indexes.

Reference: http://www.devguru.com/technologies/t-sql/7120.asp

So when you want to set the default value when you are adding a new column in the databse table, you can use the following example. I have created a column named 'tempTest' and its datatype is 'bit' and default value is '0' i.e. false.

ALTER TABLE tblTable
ADD isTempTest bit NOT NULL
CONSTRAINT [DF_tblTable_isTempTest] DEFAULT ((0))

I have added CONSTRAINT 'DF_tblTable_isTempTest' to set the default value 0.

You can add you comment here.

## Saturday, March 21, 2009

### ASP.Net Error: The web server is not configured correctly

This error will be as follows:

I resolve this error by following steps:

1> Right click on the project and select property option.

2> Go to the Web tag and you have to set the Use Visual Studio Development server instead of User IIS Web Server.

I have resolved this problem just by following above steps. I think it will help you to resolve your problem too.

## Wednesday, March 18, 2009

### Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80040154.

hi,

you can find the solution on the following link:

http://riteshk.blogspot.com/2007/05/retrieving-com-class-factory-failed-due.html

U can also check the following one.

http://forums.asp.net/p/1249300/2317080.aspx

Regards,

Vijay Modi

## Sunday, March 15, 2009

### DataReader problem + OutPutParameter

I was faced this problem yesterday. I search on Google Search engine, but found that we cannot get the OutPutParameter before closing the datareader. So if you want to get the output parameter, you have to close the datareader. After closing datareader, you can got the output parameter. But after closing the datareader you cannot retrieve out data. So if you want to resolve this problme, You have to go through the following :

If you output parament name is @IsExist
SET it with your conditions and query in Stored Procedure
SET @IsExist =1

Then Just add the SELECT statement like :
SELECT @IsExist AS IsExist

Now you can get this variable from Coding(C#) as following
bool blnIsExist = (Boolean)dr["IsExist"];

Enjoying na:)
Regards,
Vijay Modi

## Thursday, March 12, 2009

### Server Side ViewState + Performance Improvement

I assume you all who are reading this article knows about ViewState. So now some times our webpage contains lot of controls, or datagrid/gridview or some dead controls. In this situation it can grow very large. And if we are using viewstate then It will dead effect on performance.

So the solution is to remove viewstate from the client side and keep it on Seaver. There are some drawbacks to store the it on Searver Side. What I am doing is that I have override the method that store and retrieves the ViewState, namely SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium. By overriding these two intrinsic methods, we can intercept the ViewState process and perform our magic. What we are doing is simply this: You have a bunch of baggage. Probably way too much. But you only really need it when you visit the server (such as on a postback). So, instead of making you carry it all with you (which can slow down the plane and make other passengers very unhappy), we are going to arrange for you to leave it in a special place at the server, and pick it up again when you get back there. Everything works the same; you just don't have to lug it all with you. Make sense?

This is far from a new idea; there are a number of implementations of this technique. The best one I found is by Robert Boedigheimer here. Robert's solution provides a new BasePage class which handles these operations, and a viewStateServerMgr class that handles the serialization and deserialization. His implementation is the only one I've seen that also accounts for the fact that with IE, users can hit the back button and we would need to "go back" to the previous viewstate for that page in the cache. Robert made the assumption that since ViewState is unique to each user, he would store and retrieve the ViewState for each page in Session state. However, there are at least three other "places" that we can stick our serialized ViewState object, and we can still account for unique users with a unique key such as the SessionID. If we do this, we can set Session to be readonly (assuming we don't need to write to it) and thus get an additional performance boost. Those options are Application, Cache, and a static global class instance holding, for example, a Hashtable.

A simplified code example of this model, with a different implementation of a unique user key, could be as follow:
protected override void SavePageStateToPersistenceMedium(object viewState)
{
string str = "VIEWSTATE_" + Request.UserHostAddress + "_" + DateTime.Now.Ticks.ToString();
RegisterHiddenField("__VIEWSTATE_KEY", str);
RegisterHiddenField("__VIEWSTATE", "");
}

protected override object LoadPageStateFromPersistenceMedium()
{
string str = Request.Form["__VIEWSTATE_KEY"];
if (!str.StartsWith("VIEWSTATE_")) {
throw new Exception("Invalid viewstate key:" + str);
}
return Cache[str];
}

So what I did was to wire up Robert's class with some choices that could be set in the web.config -- to make it automatically use Session, Application, Cache, or my global static class, depending on the web.config setting. I then set about to create two pages. The first page uses Robert's BasePage class to inherit from, and implements the server - side ViewState scheme. The second page inherits from the typical System.Web.UI.Page class, and Viewstate is stored "in the page" as usual. Each page is essentially the same, and each page creates 1000 small viewstate entries in the Page_Load handler on first load. Each page also has a bit of javascript written to it with "Defer" - which makes the script wait until the page and all other script is rendered, and then it causes the page to postback. In this manner, I could easily run a series of web stress tests with Homer (now called "Web Application Stress") and I wouldn't have to bother with making a GET and a POST in my tests. All I am really interested in is the throughput and average requests per second under load for each scenario.

As an informational note, many developers will ask "Why didn't you use ACT from Visual Studio.NET?". ACT is great for demos where you want to show people a nice real-time graph, but my personal opinion is that it is nowhere near as reliable or feature-rich as Homer. After a number of years of this testing thing, including several eye-opening weeks at the MS Testing Lab in Charlotte, I have come to trust Homer.

Before going any further, let's take a look at the test results, which may
surprise you. We ran this test with a client machine and a server machine over a
wireless network. The server is a P4 with 1 GB RAM running Windows Server 2003
and IIS in Worker Process Isolation (HTTP.SYS) mode. We ran a two minute test
with 20 simultaneous threads and no delay. This can be considered moderate
stress. None of the tests had any HTTP or socket errors. The regular ViewState
test without the server-side scheme is in the first column, then the four server
side schemes follow:
 VIEWSTATE WEB STRESS COMPARISON TEST NAME VIEWSTATE SESSION APPLICATION CACHE GLOBALS NUMBER OF HITS 3322 18483 18476 20170 16723 REQUESTS /SEC 27.64 153.8 153.74 167.84 140.32 TOTAL BYTES REC'D (KB) 68016.63 22923.25 22977.13 25074.51 20798 PERCENT DIFFERENCE N/A 456.44% 456.22% 507.24% 407.67%

As can be seen above, the winner is - surprise - storing the ViewState in
Cache, at almost 168 requests per second. That is an approximate 500
percent improvement in throughput
over regular ViewState. All of the
server-side options outperformed regular ViewState, with static global Hashtable
storage being the worst performer. You can download the solution I used to
create these tests below, and tweak it if you like. I'd be interested in anyone
else's results in this area.

Conclusion: ASP.NET ViewState is a great invention that makes the developer's life easier. It also can create a lot of HTML baggage that slows down performance. By storing ViewState in either Session or Cache, you can have your ViewState and eat it, too.
Taking the time to develop a quality stress testing scenario to prove out (or disprove) one's hypotheses provides the scientific basis in fact to help developers make educated, sound decisions about their application architecture.

You can get an example of it from the following link:

Reference: Peter A. Bromberg : http://www.eggheadcafe.com/articles/20040613.asp

http://www.codeproject.com/aspnet/ServerViewState.asp
Regards,
Vijay Modi

## Sunday, March 8, 2009

### The following module was built either with optimizations enabled or without debug information

When you find this bug, follow the following steps in sequence:
1>Go to bin folder of you project and remove the dll where you find above error.
2> Browse the project and right click on bin folder and uncheck readonly checkbox. Click OK.
3> Right click on project and click on add reference option. Add the existing project as dependency project.
4> Build web service and test it.

It will resolve your problem. If you find more help send me reply he in comments.

Regards,
Vijay Modi

## Saturday, March 7, 2009

### Button onClick and onClientClick

Today I got a comment regarding what is the difference between onClick and onClientClick. So I think to write a small article on it.

Please find the following code for. I write the code for .aspx page. Copy and paste this code in your aspx page.

========================================================================================
<html xmlns="http://www.w3.org/1999/xhtml" >
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function confirmthis()
{
if(confirm("Do you want to do a server trip?"))
{
return true;
}
else
{
return false;
}
}
</script>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" OnClientClick="return confirmthis();" Text="Click Me..." /></div>
</form>
</body>
</html>

========================================================================================

Copy and paste following code in your code behind(aspx.cs) page.

========================================================================================
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text="U click Button1"
}

========================================================================================

Now run your project. just Click on the button "Click Me...". It will ask to "Do you want to do a server trip?". If you select YES then you will do a server trip and when you select NO you will not redirect to server. So here for validation purpose we are using onClientClick and for doing process on server side, we are using onClick.
Best Regards,
Vijay Modi

## Friday, March 6, 2009

### JavaScript + Blinking /Flash behind TextBox

Hi today I trying to make a blinking text box and found an important script from the web. I have created a html page and test it. Its really very good script. So if do you want to craete a blinking textbox, go through the following code and you can create your own blinking textbox.

<HTML>
<TITLE> Blinking TextBox </TITLE>
<script>
{
args = (/,/.test(args))? args.split(/,/): [args,'#FFD100',10];
var who = document.getElementById(args[0]);
var count = parseInt(args[2]);
if (--count <=0)
{
who.style.backgroundColor = '';
if(who.focus) who.focus();
}
else
{
args[2]=count+'';
who.style.backgroundColor=(count%2==0)? '': args[1];
args='\"'+args.join(',')+'\"';
}
}
</script>

<table>
<tr>
<td width="50"><b>Name:</b></td>
<td width="300">
<input id="name" type="text">
</td>
</tr><tr>
<td width="50"><b>E-mail:</b></td>
<td width="300">
<input id="email" type="text">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Submit" onClick="alert('Your form would have been submitted')">
</td>
</tr>
</table>
</BODY>
</HTML>

Regards,
Vijay Modi

## Wednesday, March 4, 2009

### JavaScript Events

##### Hi Friends,

I am here giving some Events regarding buttons in JavaScript.

##### onClick

We've already used this event quite a lot. But you can use it with buttons, images, links, radio buttons, check boxes. Here's a simple onClick event used with an image:

<IMG SRC = red.jpg onClick = "alert('No stealing the images!')">

##### onDblClick

Same as above, really. Try inserting Dbl into onClick and see what happens.

##### onKeyDown

This events fires when a key on your keyboard is pressed. It applies to buttons, textboxes, text areas, and links. If you had a search box on a form, for example, you might want to activate the search when the user presses the Return/Enter key on the keyboard. For Netscape users, though, you need to use this:

window.captureEvents(Event.KEYPRESS)

And that's only the start of your problems!

An easier example of the KeyDown event that works in both browsers is this:

<INPUT type = text onKeyDown = "alert('Key pressed')">

##### onMouseOver

You've seen this in action already when we wrote the script for the "dancing hand". Associated events are onMouseOut and onMouseDown. They are mainly used for links and images. A typical use of onMouseOver is to swap images around when creating a rollover effect.

##### Onblur

This event takes places when objects lose focus. If you click inside one text box then click outside it the textbox has lost focus. That's when the onBlur event fires.

<INPUT TYPE = text onBlur = "alert('Lost focus')">

Here's an example. Click inside the first text box, then click inside the second one.

When you move away from the textbox, you should see the alert box. You can write code to check if something like an email address is correct. If not, you can reset the text box to a blank string.

##### onSubmit

This is a very useful event that can be used for data validation on a form. You can use this event with a Submit button. The details on the form can then be checked for errors. If you catch any errors, you can then stop the form's details from being submitted. Here's an example. Note the use of the word return. This is set to a Boolean value. If return is false then the form doesn't get submitted; if it's true then the form is submitted. (More about return in the next section.)

<FORM name = f1 onSubmit = "return Validate()">

<INPUT Type = Submit Value = " Send ">

</FORM>

The form is not much good because it only has a submit button. But notice where the onSubmit event is - in the FORM tag, and not with the Submit button.

Here's the Validate() function. It doesn't do any checking. All it does is to display an alert message.

function Validate() {

Details = false

if (Details == false) {

return false

}

if (Details == true) {

return true

}

}

In the function, we've set a variable (Details) to false. This is just for testing purposes, and means the user has filled out the form incorrectly. Look at the two return values, though. If the Details are false then return gets set to false, and the form isn't submitted; if the Details are true then return is true, and the form is submitted.

If you want, add a Method and an Action to your Form. Like this one:

<form name = f1 onSubmit = "return Validate()"

Method = post Action="Mailto:MyEmailAddress@MyISP.com" Enctype="text/plain">

(The Enctype will send the details in plain text that's much easier to read.)

Test out the code on a web page. Change the Details variable to true and click the button. We're going to do some real error checking in the next section, and we'll meet onSubmit again.

Speaking of that next section - let's get right to it.

Reference: http://homepage.ntlworld.com/kayseycarvey/jss3p3.html

Regards,

Vijay Modi

## Saturday, February 28, 2009

### Javascript Parent Child window / window.open method / Open PopUp window

Do you want to open PopUp window from your current window. It can open by using javascript's window.open method. The new opened window is called the Child window and from which window you have open it is called Parent window.

The syntax of window.open is as follows:

open (URL, windowName[, windowFeatures])

Where URL is the url of the page which you want to open.
windowname is a name given to the new window
windowFeatures is the string which can include status bar, address bar etc.. window features will be included in the new popup window.

For example:
window.open ("http://vijaymodi.wordpress.com","Vijay Modi's Blog");

will opens a new browser window with standard features.

To open a window with statusbar and toolbar you have to write the following code:
window.open ("http://vijaymodi.wordpress.com","Vijay Modi's Blog","status=1,toolbar=1");

The following table shows the features and the string tokens you can use in the features depends on your requirements:
status The status bar at the bottom of the window.
toolbar The standard browser toolbar, with buttons such as Back and Forward.
location The Location entry field where you enter the URL.
menubar The menu bar of the window
directories The standard browser directory buttons, such as What's New and What's Cool
resizable Allow/Disallow the user to resize the window.
scrollbars Enable the scrollbars if the document is bigger than the window
height Specifies the height of the window in pixels. (example: height='350')
width Specifies the width of the window in pixels.

Regards,
Vijay Modi

## Sunday, February 22, 2009

### Javascript Parent Child window / window.open method / Open PopUp window

Do you want to open PopUp window from your current window. It can open by using javascript's window.open method. The new opened window is called the Child window and from which window you have open it is called Parent window.

The syntax of window.open is as follows:

open (URL, windowName[, windowFeatures])

Where URL is the url of the page which you want to open.
windowname is a name given to the new window
windowFeatures is the string which can include status bar, address bar etc.. window features will be included in the new popup window.

For example:
window.open ("http://vijaymodi.wordpress.com","Vijay Modi's Blog");

will opens a new browser window with standard features.

To open a window with statusbar and toolbar you have to write the following code:
window.open ("http://vijaymodi.wordpress.com","Vijay Modi's Blog","status=1,toolbar=1");

The following table shows the features and the string tokens you can use in the features depends on your requirements:
status The status bar at the bottom of the window.
toolbar The standard browser toolbar, with buttons such as Back and Forward.
location The Location entry field where you enter the URL.
menubar The menu bar of the window
directories The standard browser directory buttons, such as What's New and What's Cool
resizable Allow/Disallow the user to resize the window.
scrollbars Enable the scrollbars if the document is bigger than the window
height Specifies the height of the window in pixels. (example: height='350')
width Specifies the width of the window in pixels.

Regards,
Vijay Modi

## Wednesday, February 18, 2009

### ASP.Net Send mail

I have write a function to send mail in asp.net. Sending mail is an important feature of each and every project. And so I write this article and providing one function to send mail.

Public Function SendMail(ByVal Sender As String, ByVal Receiver As String, ByVal Subject As String, _
ByVal CC As String, ByVal BCC As String, ByVal Message As String)

Dim NewMailToUser As New MailMessage
NewMailToUser.From = Sender

If Not (CC = String.Empty) OrElse Not IsNothing(CC) Then
NewMailToUser.Cc = CC
End If

If Not (BCC = String.Empty) OrElse Not IsNothing(BCC) Then
NewMailToUser.Bcc = BCC

End If

NewMailToUser.Subject = Subject
NewMailToUser.BodyFormat = MailFormat.Html
NewMailToUser.Body = Message
SmtpMail.SmtpServer = String.Empty 'SMTP server name or address. You have to change depends on your SMTP server
SmtpMail.Send(NewMailToUser)

End Function

You can use this function to send mail and you can call it as following:

SendMail(strSender, strTo, strSubject, Nothing, Nothing, strMessage)

Enjoying Programming,
Regards,
Vijay Modi

### CGI Error-The specified CGI application misbehaved by not returning a complete set of HTTP headers

The "CGI Header" error typically this happens more on a faster machine (it has to do with timing of IIS/PHP and database connections). Logging out of the PureCMS system might result in IIS responding with a CGI Error. Refreshing the client browser (press the F5 key) typically results in the login page correctly appearing. If this error happens regularly, try configuring your web server to be optimized for Programs (not Background Services). These options can be found in the System control panel under Performance Options.

There is another option if optimizing your Web server for Programs does not solve the problem. There is a free utility called "FastCGI" that is a generic "plug in" for IIS that helps to execute CGI applications (PHP, Perl, etc.) faster by pooling those processes rather than making IIS launch them for every request. This has been shown to work well with PureCMS to avoid the "CGI Header Error" issues mentioned above.

Setting Up FastCGI on IIS for PureCMS

Place the "isapi_fcgi.dll" file into the "App\PHP" subfolder of your PureCMS installation directory, e.g. "D:\PureCMS\App\PHP" (the same directory as php.e-x-e)
Copy and paste the following text (between the "----" lines) into a text editor (such as Notepad). Modify the file path for PHP appropriately (point it to your installation folder for PureCMS), and save the file with a ".reg" extension. Then double-click that file and click "Yes" to merge this information into your registry. Make sure that the file names are in 8.3 format. For example, instead of "c:\program files\globalscape\purecms" use "c:\progra~1\global~1\purecms".
------------------- fastcgi.reg -------------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI]
"StartServers"=dword:00000005
"IncrementServers"=dword:00000002
"MaxServers"=dword:00000019
"Timeout"=dword:00000258

[HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI\.php]
"AppPath"="D:\\PureCMS\\app\\php\\php.exe"
"BindPath"="php-fcgi"
---------------------------------------------------------

Change script mappings for .PHP to point to D:\PureCMS\app\php\isapi_fcgi.dll instead of PHP.exe. This is done in the IIS manager: right-click on the PureCMS site and choose "Properties." Change to the "Home Directory" tab and click the "Configuration" button in the bottom right. Go to the "App Mappings" tab. Find the ".php" extension in the "Application Mappings" list, click it and choose "Edit." For the Executable entry, "Browse" and find the isapi_fcgi.dll location and choose that.
If you are configuring IIS on a Win2K3 machine, you must also take the extra step of adding it as an allowed ISAPI extension. (see IIS help file for more details, or ask us to help!)
If you are not running on Win2K3, you should toggle Application protection from "High" to Medium" to "High" due to some weird IIS issue. To do so, right-click on your PureCMS site in IIS manager and choose Properties. In the "Home Directory" tab, change the "Application Protection" list to "Medium" and press APPLY. Then change it back to "High" and press Apply again. If you are curious about why this is necessary, read here: http://www.ensim.com/support/wwp/documents/wwp_pro_3.2_docs/wwp32_applHelp/WebHelp/Sites-related.htm
Copy PHP.INI from d:\PureCMS\Main\ into d:\PureCMS\App\php\php.ini (this is a very important step!!!)
8) For FastCGI to work properly, you will need to use PHP 4.3.4; PureCMS ships with PHP 4.3.3.
Download PHP 4.3.4 here, and unzip the following files into your PureCMS PHP folder (e.g. c:\program files\globalscape\purecms\app\php\) -- overwrite whatever files are already there: php.exe, php_ts.dll, and mssql.dll
Restarted the web server. To do so, open a command prompt window and type "iisreset".
Access PureCMS from a browser. Installing FastCGI should eliminate the "This application has misbehaved" errors.