HTML to word doc at runtime simplest trick

Dear Friends,
Recently my friend got a new task to generate a word & PDF document at runtime from FCK Editor and he was in real hurry, so he told me a sample for him. I tried with a simple which I am sharing here.
I created a resume layout with FCK editor. Please find the below screen and code.

HTML to word

now code is here

Generate html to Word
I hope you will also enjoy.

you can download code  at
Thanks & Best Regards,
Rajat Jaiswal

Are you a smart Dotnet Developer?

Dear Friends,

As you are using Microsoft Visual Studio you have proved you already a smart person.
Most of the time we are doing lot of hard work to execute a project. If we see our back so we observe that we write thousand of the lines for a project (without actual logic). Sometimes a minor project can take number of days to complete.
When you think about a project most of the time we have to write same line of code except the core logic.  But again we have to write whole bunch of lines for the project and put lot of efforts from our side.
I realized that sometime I am only hard working programmer not smart programmer while I have many options provided by Microsoft to make myself a smart work. Although I tried many times to be smart programmer as you have seen in my previous articles like database utility, three tier architecture code generator, Macros code generator etc.
Here I want to share a small utility provided by Microsoft visual studio which will be a step towards making our self smart. Although this topic needs to be introduce in the same series of code generator but I am really sorry, I missed this utility at that time. Recently one of my friends asked me this question so I thought this should be share with every one because we are a team.
I know some of you aware of this utility, some of you using this but it is for those friends who really wants to improve and not aware of this.
The utility function is “Snippets “.  Are you surprised? , I don’t think so.
A snippet is a utility provided by Visual studio which is helpful in making us smart programmer.
We can access the Snippets by using Ctrl + K, ctrl + X key. When you press this in visual studio you will get the list of existing snippets codes existing is visual studio. We just need to select particular code which we required and change small variable declaration and bang, we will find we write a complete code in few minutes.
As shown in fig (1) we are accessing crystal report code

Great fig (2) shows we created bunch of lines for accessing crystal report by just simple clicks  one  more great thing is you don’t need to add reference in your code for require DLL the snippet automatically handle that.

We can create our own snippets and use them. For this we have to create a XML and whose structure is as follows.
<CodeSnippet Format=”1.0.0″>
Complex logic of Rajat Snippet
<Code Language=”CSharp”>
We can write n number of lines here with complex code

I hope it would be helpful topic enjoy smartness.

I urge you to share more utility which make us smart programmer.
Thanks & Regards
Rajat Jaiswal

Utility for Printing all the PDF from a folder

Hello friends,
Recently one of my friends needed a utility. According to
his need the application just select the folder and print all the PDF files
which are in the folder.
So I made a simple windows application which execute acrobat
reader exe with /h/p option which print all the PDF one by one.

You can download the source code from

Enjoy utility.

Thanks & Regards
Rajat Jaiswal

Secure your code from Reverse engineering & encrypt your code

Hello friends,
After developing complex business logic application in .NET most of this we think how to secure our application code? How to prevent our website or software from reverse engineering?, Encrypt your code.
Because we know there are many tools which break the DLL like Reflector.

To prevent the DLL from reverse engineering there are many obfuscation tool. There are many obfuscation tools. Obfuscator (DotFuscator community edition) is one of the free tools which provide protection from reverse engineering.
It obfuscates the DLL. It is easy in use.  The steps are very simple just select the DLL and build.
It will obfuscate the code.
Hope it will help in securing your application from Hacker from reverse engineering.

Thanks & Regards
Rajat Jaiswal

Hack SQL Injection with prevention (Secure your web site )

Dear All,
I am always curios about hacking not in destructive manner but how to prevent my sites from hacking.
So one of the thing which I want to share with you is “SQL Injection “. SQL Injection is a unique way by which you can play with database of the site.
Firstly I give you a brief introduction about SQL injection and then I will provide you information how to prevent your site by SQL injection.
So SQL injections are just like SQL statements or we can say combination of SQL statements which can be used as destructive manner by hackers.
And you cannot believe how SQL Server is powerful. With the help of” xp_cmdShell “command then end user (hacker) can crash your server too. With the help of “xp_cmdShell” you can do many things like delete file, delete dir, shutdown even format too.
So first let me show you basic example
Suppose you have login screen
on which you have done following code to validate user on
protected void btnLogin_Click(object sender, EventArgs e)
String connectionString = ConfigurationManager.ConnectionStrings[“ConnectionString”].ConnectionString;
SqlConnection sqlcon = new SqlConnection(connectionString);
SqlCommand sqlcmd = new SqlCommand();
sqlcmd.CommandText = “SELECT * FROM tblUser WHERE strUserName ='” + txtUserName.Text + “‘ AND strPassword ='” + txtPassword.Text + “‘”;
sqlcmd.CommandType = CommandType.Text;
sqlcmd.Connection = sqlcon;
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = sqlcmd;
DataSet ds = new DataSet();
if (ds.Tables[0].Rows.Count > 0)
Response.Write(“Valid user”);
Response.Write(“Invalid user”);

Now if you see here we have directly used txtUserName, and txtPassword value here.

Now if end user enters following value as shown your screen.
SQL Injection
Now put break point on your sqlcommand statement and see what value going on.
You will find following SQL command.
SELECT * FROM tblUser WHERE strUserName =’Rajat’ OR ‘1’ =’1’ AND password =’test’ OR ‘1’ =’1’
Now when you run this command in your SQL Browser you will be surprised that it returns all the Records. So this is power of SQL injection with just “OR “statement.

Prevent hacking
Now if you have aware of SQL Server than you understand “;” (semicolon) & — (dash dash) means.
“;” semicolon means current statement is completed and — (dash dash) means comment.
So suppose, if I enter semicolon combination with update command on my username password screen then what happen
SELECT * FROM tblUser WHERE strUserName =’RAJAT’ OR ‘1’=’1’ ; update tblUser set password =’’; —

Other than this a hacker can user various combination like this.

Now question came in your mind how to prevent this.
So here are the basic things by which you can prevent your site by SQL injections
1) Apply check for special character on login form textbox
2) Use storedprocedures
3) Use encrypted password
I hope you will be more secure programmer now so enjoy secure sites.

In future i will provide you how a hacker can hack your site and how can you prevent your site.

Rajat Jaiswal

Three tire code Generator using VB.NET

Hello Friends,
Today I am sharing code generator.  Its   interface is simple same as our stored procedure code generator. (**Important   I am using Microsoft Application block for Data Access Layer**)
You need to give user credential as shown in below fig.

Once the credential is successful you will get below screen.

Just select the table for which you want to generate code.    Now if you want dataset as entity then just check the use dataset checkbox.
Then press Generate button.

It will   generate y our windows form, Business manager class, Data Access layer class.
Just copy and paste in your project it will work fine with some minor changes.
You can download the code from below link
Download code
Enjoy coding!!
Thanks & Regards
Rajat Jaiswal website in hindi or other native language with simple steps

Dear all,
For Indian its great news that you can now create web site in your native language like Hindi, Marathi, Punjabi, Urdu, Tamil etc.
Kudos to Microsoft for introducing “Microsoft Indic Language” with help of this we can easily create web site in any language without doing much efforts.
So here we go  with the sample  and things to remember with simple step

Step 1:- Add following line in your html page

input type=”hidden” id=”MicrosoftILITWebEmbedInfo” attachMode=”optout” value=””

<script type=”text/javascript” src=”” defer=”defer”></script>

Remember here:  I am using hindi here that’s why i used hindi.js you can use your own choice.
Step 2:- Add new attribute with each input control which is “MicrosoftILITWebAttach” as shown in below.
<    asp:TextBox ID=”txtPost” runat=”server” MicrosoftILITWebAttach=”true”             ></asp:TextBox>

Step 3:- If you want to store this value in database the just remember all the field which contain string data type should be “NVARCHAR”
Otherwise your searching will not work and all the data will be change to question mark instead of actual data.

Step 4:- for searching in database hindi text or text which you insert you have to use following syntax

SELECT * FROM tblPost where postName =N’प्रोफेसर’
So Enjoy


How to determine whether particular port is open or not with IPAddress?

Dear All,

Sometime you face problem that whether a particular port is open or not for an IPaddress. The reason  may be firewall so first disable firewall.

So to determine this do particular steps.

Step 1:-

Click on start button of windows.

Step 2:-

Click on Run

Step 3:-

Type cmd  and press enter

Step 4:- you will get command prompt screen  type Telnet in command prompt screen

You will get   Telnet Prompt.

Step 5: type OPEN  IPAddress  port 

Step 6:- press enter  if new blank window is Opened  then port is open for IPAddress otherwise it not.

 Hope this will help you.