Web to Windows Application shift was not something i was hoping for when i stared with ASP.NET.
But as it turns around i got a Good Domain "Medical Insurance" to work on, and so i readily accepted the challange.
Been busy eversince last 4 months.
Hey it does get boring at times but just look at the good things i got to learn...
1.Large database handling techniques!!
2.Really improved my SQL Server knowledge and skills.
3.Learnt a lot more about Crystal Reports and Windows Application.
4.Got to know how to communicate with clients (USA). And loving it!
5.Really learnt how to work in a shared environment, using source safe, communicating with developers across the globe, coding standards etc etc.
So all in all its a great addition to my Resume!
And now the Best Part is that we are implementing the same functionality on a Web Portal as well.
Ain't that great!!
ASP.NET here i come again!!
ASP.NET MVC, Javscript, JQuery, Angular JS, HTML 5, CSS3
Web Services, Web Api, SQL Server, C#.NET, Azure
06 June 2010
01 April 2010
Web 2.0 pop-up dialog using Ajax Control Toolkit
Tired of using the old boring Windows Xp style JavaScript pop-ups to get user confirmation on a web page?
Then you have come to the right place cause i will just show you how easy it is to create a customized Vista type confirm dialog using the Ajax Control Toolkit and ASP.NET 2.0 or greater.
There's absolutely no need to know any hard core JavaScript here !!
So here are the steps:
Step 1: Install the Ajax Control Toolkit on your machine if already not done. Start your web application and add the Ajax Control Toolkit dll to your bin folder.
Step 2: Include the following the reference on your page
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
Alternative if you have configured your Toolbox then simply ignore the step 1,2 and go directly to step 3.
Step 3: Now you would require to add a asp:Panel on your page that will hold the HTML required for the popup screen. ex:
<asp:Panel ID="PanelDeleteAlert" runat="server" CssClass="confirmBox"
Style="display: none;width: 300px;">
<div id="confirmHeader">
<span>Confirm</span></div>
<div id="confirmMsg" align="center">
<div class="rowdiv">
<div class="celldiv">
<img src="../images/confirm.gif" alt="" /></div>
<div class="celldiv">
<span>Delete<asp:Label ID="lblDeleteName"
runat="server" Font-Bold="true" Text="Do you want to delete this?"></asp:Label>
from contact list?</span></div>
</div>
</div>
<div id="confirmButtons">
<asp:Button ID="ButtonOk2" runat="server" Text="OK"
CssClass="button" />
<asp:Button ID="ButtonCancel2" runat="server"
Text="Cancel" CssClass="button" />
</div>
</asp:Panel>
Step 4: Now you need a LinkButton/Button on who's click you need to show the pop-up, an ConfirmButtonExtender & an ModalPopupExtenderfrom from Toolkit. Configure these as follows:
<div style="float: right">
<asp:LinkButton ID="butDelete" OnClick="butDelete_Click"
runat="server" CssClass="linktext" Text="Delete Contact"></asp:LinkButton>
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender2"
runat="server" TargetControlID="butDelete" ConfirmText="Do you want to delete this
contact?" DisplayModalPopupID="ModalPopupExtender2" Enabled="True">
</cc1:ConfirmButtonExtender>
<cc1:ModalPopupExtender ID="ModalPopupExtender2"
runat="server" TargetControlID="butDelete" PopupControlID="PanelDeleteAlert"
OkControlID="ButtonOk2" CancelControlID="ButtonCancel2" BackgroundCssClass="modalBackground" />
</div>
Step 5: You need to create proper CSS for the Panel and for the background when the Pop-up is open. You can use your imagination for designing the Panel and for the Background you can use the following CSS
/*Modal Popup*/
.modalBackground {
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}
.modalPopup {
background-color:#ffffdd;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
Step 6: That's it go ahead and test your application
So as you can see using your own imagination and some good CSS techniques , you can come up with a really neat looking confirmation dialog!!
Then you have come to the right place cause i will just show you how easy it is to create a customized Vista type confirm dialog using the Ajax Control Toolkit and ASP.NET 2.0 or greater.
There's absolutely no need to know any hard core JavaScript here !!
So here are the steps:
Step 1: Install the Ajax Control Toolkit on your machine if already not done. Start your web application and add the Ajax Control Toolkit dll to your bin folder.
Step 2: Include the following the reference on your page
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
Alternative if you have configured your Toolbox then simply ignore the step 1,2 and go directly to step 3.
Step 3: Now you would require to add a asp:Panel on your page that will hold the HTML required for the popup screen. ex:
<asp:Panel ID="PanelDeleteAlert" runat="server" CssClass="confirmBox"
Style="display: none;width: 300px;">
<div id="confirmHeader">
<span>Confirm</span></div>
<div id="confirmMsg" align="center">
<div class="rowdiv">
<div class="celldiv">
<img src="../images/confirm.gif" alt="" /></div>
<div class="celldiv">
<span>Delete<asp:Label ID="lblDeleteName"
runat="server" Font-Bold="true" Text="Do you want to delete this?"></asp:Label>
from contact list?</span></div>
</div>
</div>
<div id="confirmButtons">
<asp:Button ID="ButtonOk2" runat="server" Text="OK"
CssClass="button" />
<asp:Button ID="ButtonCancel2" runat="server"
Text="Cancel" CssClass="button" />
</div>
</asp:Panel>
Step 4: Now you need a LinkButton/Button on who's click you need to show the pop-up, an ConfirmButtonExtender & an ModalPopupExtenderfrom from Toolkit. Configure these as follows:
<div style="float: right">
<asp:LinkButton ID="butDelete" OnClick="butDelete_Click"
runat="server" CssClass="linktext" Text="Delete Contact"></asp:LinkButton>
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender2"
runat="server" TargetControlID="butDelete" ConfirmText="Do you want to delete this
contact?" DisplayModalPopupID="ModalPopupExtender2" Enabled="True">
</cc1:ConfirmButtonExtender>
<cc1:ModalPopupExtender ID="ModalPopupExtender2"
runat="server" TargetControlID="butDelete" PopupControlID="PanelDeleteAlert"
OkControlID="ButtonOk2" CancelControlID="ButtonCancel2" BackgroundCssClass="modalBackground" />
</div>
Step 5: You need to create proper CSS for the Panel and for the background when the Pop-up is open. You can use your imagination for designing the Panel and for the Background you can use the following CSS
/*Modal Popup*/
.modalBackground {
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}
.modalPopup {
background-color:#ffffdd;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
Step 6: That's it go ahead and test your application
So as you can see using your own imagination and some good CSS techniques , you can come up with a really neat looking confirmation dialog!!
14 June 2009
Encrypt Sensitive Data in SQL Server 2005
SQL Server 2005 provides easier functions for encrypting and decrypting user sensitive information such as credit card numbers or bank account details, so as to deter any hacking attempts.
Data encryption in SQL Server 2005 can be done either by using password mechanism or by making use of keys and certificates. These methods are as follows:
1.Encryption by PassPhrase
This is a simple method in which we use the SQL method EncryptByPassPhrase('password','original_value') with our insert,update,select queries.
For an example suppose we have a table named user_info with the column named credit_card_no (varchar) in which we have to stored the encrypted credit card no then the query would be as follows:
Update user_info set credit_card_no=EncryptByPassPhrase('password',@credit_card_no);
where password is the key used to generate the encrypted value.
The same key is used to decrypt the credit_card_no as follows:
Select DecryptByPassPhrase('password',credit_card_no) as decrypted_no from user_info.
Note:The password has to be protected and remembered by the programmer. Hence can be vulnerable.
2.Encryption by Keys
The limitation of encryption by passphrase method is that we have to supply the password each time the data has to be accessed. But if we encrypt our symmetric key with a certificate then we won't have to pass the passphrase each time. To create a key or its certificate, we must first create or open the master key for the database.
The following command creates a master key:
create master key encryption by password='password';
Now we can create a certificate and then a symmetric key that is attached to that certificate. The following SQL script creates the certificate 'DemoCert' and a key 'DemoKey' associated with that certificate:
create certificate DemoCert with subject='Demo Certificate;
create symmetric key DemoKey with algorithm=AES_256 encryption by certificate DemoCert;
Now that we possess a key we can do encryption using the EncryptByKey() method and considering the previous table user_info as follows:
open symmetric key DemoKey decryption by certificate DemoCert;
update user_info set credit_card_no=EncryptByKey(Key_GUID('DemoKey'),@credit_card_no);
Similarly we can decrypt it as follows:
open symmetric key DemoKey decryption by certificate DemoCert;
select cast(DecryptByKey(credit_card_no) as varchar(16)) as decrypted_no from user_info;
This is a lenghty method but is very secure as we do not have to pass the password for the process of encryption/decryption.
So this is one advance features of SQL Server 2005 that not many of us use. But it can surely come in handy when dealing with large user database that requires some security features!!
Data encryption in SQL Server 2005 can be done either by using password mechanism or by making use of keys and certificates. These methods are as follows:
1.Encryption by PassPhrase
This is a simple method in which we use the SQL method EncryptByPassPhrase('password','original_value') with our insert,update,select queries.
For an example suppose we have a table named user_info with the column named credit_card_no (varchar) in which we have to stored the encrypted credit card no then the query would be as follows:
Update user_info set credit_card_no=EncryptByPassPhrase('password',@credit_card_no);
where password is the key used to generate the encrypted value.
The same key is used to decrypt the credit_card_no as follows:
Select DecryptByPassPhrase('password',credit_card_no) as decrypted_no from user_info.
Note:The password has to be protected and remembered by the programmer. Hence can be vulnerable.
2.Encryption by Keys
The limitation of encryption by passphrase method is that we have to supply the password each time the data has to be accessed. But if we encrypt our symmetric key with a certificate then we won't have to pass the passphrase each time. To create a key or its certificate, we must first create or open the master key for the database.
The following command creates a master key:
create master key encryption by password='password';
Now we can create a certificate and then a symmetric key that is attached to that certificate. The following SQL script creates the certificate 'DemoCert' and a key 'DemoKey' associated with that certificate:
create certificate DemoCert with subject='Demo Certificate;
create symmetric key DemoKey with algorithm=AES_256 encryption by certificate DemoCert;
Now that we possess a key we can do encryption using the EncryptByKey() method and considering the previous table user_info as follows:
open symmetric key DemoKey decryption by certificate DemoCert;
update user_info set credit_card_no=EncryptByKey(Key_GUID('DemoKey'),@credit_card_no);
Similarly we can decrypt it as follows:
open symmetric key DemoKey decryption by certificate DemoCert;
select cast(DecryptByKey(credit_card_no) as varchar(16)) as decrypted_no from user_info;
This is a lenghty method but is very secure as we do not have to pass the password for the process of encryption/decryption.
So this is one advance features of SQL Server 2005 that not many of us use. But it can surely come in handy when dealing with large user database that requires some security features!!
03 June 2009
Directory, Files Listing using GridView
Web Hosting Control Panel Type Directory Listing!!
Have you ever seen a Control Panel provided for a web hosting account? Notice the way they use, to show all the files and folders inside your sites folders? Well just in case you were wondering how to do the same using ASP.NET 2.0 then let me tell you that i have achieved the same using quiet a simple technique that i found Googling around!
The following piece of code demonstrated how by using the System.IO namespace and the ASP.NET 2.0 GridView, we can achieve the task of folder/files listing very easily........
ASPX Page:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" />
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="true" />
Code Behind:
protected void page_load()
{
ListFolder();
}
protected void ListFolder()
{
string basepath="~/myfolder";
DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath(basepath));
//For All Files
FileInfo[] fileInfo = dirInfo.GetFiles("*.*",SearchOptions.AllDirectories);
//For All Subdirectories
DirectoryInfo[] subDirInfo = dirInfo.GetDirectories("*.*",AllDirectories);
GridView1.DataSource = fileInfo;
GridView1.DataBind();
GridView2.DataSource = subDirInfo;
GridView2.DataBind();
}
As you can see this method takes very little code and you can even customize it to provide delete functionality. Furthermore by combining the files and folders dataset we can achieve a complete directory listing.
Have you ever seen a Control Panel provided for a web hosting account? Notice the way they use, to show all the files and folders inside your sites folders? Well just in case you were wondering how to do the same using ASP.NET 2.0 then let me tell you that i have achieved the same using quiet a simple technique that i found Googling around!
The following piece of code demonstrated how by using the System.IO namespace and the ASP.NET 2.0 GridView, we can achieve the task of folder/files listing very easily........
ASPX Page:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" />
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="true" />
Code Behind:
protected void page_load()
{
ListFolder();
}
protected void ListFolder()
{
string basepath="~/myfolder";
DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath(basepath));
//For All Files
FileInfo[] fileInfo = dirInfo.GetFiles("*.*",SearchOptions.AllDirectories);
//For All Subdirectories
DirectoryInfo[] subDirInfo = dirInfo.GetDirectories("*.*",AllDirectories);
GridView1.DataSource = fileInfo;
GridView1.DataBind();
GridView2.DataSource = subDirInfo;
GridView2.DataBind();
}
As you can see this method takes very little code and you can even customize it to provide delete functionality. Furthermore by combining the files and folders dataset we can achieve a complete directory listing.
17 May 2009
Free Shopping Cart Solutions
Free Shopping Carts - OsCommerce, Cre Loaded, Magento....
Its been days since i have return my last post. I was kept really busy by my employer. To be honest i was also a bit lazy in thinking of something new for my blog.
None of the less i spent a lot of my recent time working on free Shopping Cart Applications.
There are some really interesting points that i would like to share about these Apps.
First of all the very thing that came to my mind is that "If people are providing good free software on the internet then what will happen to us hard working Software Developers".
To back up my thoughts i would like to press the points that these free Shopping Cart solutions provide a great bit of functionality, something that would take a lot of time to build from the scratch. Also the communities are pretty active and provide further customization support.
A few of their cool features include.
1.CMS support
2.Paypal , Authorize.Net etc payment modules.
3.FedEx , UPS, UPSC etc shipping modules.
4.Multilingual Suppport.
5.Multi Store Support (Magento)
6. And off course great catalog support
The sad part for me was that the only major thing that i was doing is understanding the structure, design integration and bug solving!!
There were times when i was really scratching my brains trying to search solution to a simple problem and just couldn't find it. Yes and Magento was the one to be blamed!!!
But the fact that not may people are aware of these Free Applications (yes these people are the end clients), having knowledge of customizing them can really be very handy.
Here's a short rating of the apps based on my experience of handling them:
1.CRE Loaded - Great out of the box and easy to setup, tech support
2.Magento - Huge functionality provided but takes ages to understand and setup due to overly streched mechanism. Also functions really Slowly(and i mean really slowly compared to any PHP site)
3.Oscommerce - Base version of cre loaded. Needs lot of customization.
4.Joomla-Virtue Mart - Has the power of Joomla with it. Good for setting up small store.
Its been days since i have return my last post. I was kept really busy by my employer. To be honest i was also a bit lazy in thinking of something new for my blog.
None of the less i spent a lot of my recent time working on free Shopping Cart Applications.
There are some really interesting points that i would like to share about these Apps.
First of all the very thing that came to my mind is that "If people are providing good free software on the internet then what will happen to us hard working Software Developers".
To back up my thoughts i would like to press the points that these free Shopping Cart solutions provide a great bit of functionality, something that would take a lot of time to build from the scratch. Also the communities are pretty active and provide further customization support.
A few of their cool features include.
1.CMS support
2.Paypal , Authorize.Net etc payment modules.
3.FedEx , UPS, UPSC etc shipping modules.
4.Multilingual Suppport.
5.Multi Store Support (Magento)
6. And off course great catalog support
The sad part for me was that the only major thing that i was doing is understanding the structure, design integration and bug solving!!
There were times when i was really scratching my brains trying to search solution to a simple problem and just couldn't find it. Yes and Magento was the one to be blamed!!!
But the fact that not may people are aware of these Free Applications (yes these people are the end clients), having knowledge of customizing them can really be very handy.
Here's a short rating of the apps based on my experience of handling them:
1.CRE Loaded - Great out of the box and easy to setup, tech support
2.Magento - Huge functionality provided but takes ages to understand and setup due to overly streched mechanism. Also functions really Slowly(and i mean really slowly compared to any PHP site)
3.Oscommerce - Base version of cre loaded. Needs lot of customization.
4.Joomla-Virtue Mart - Has the power of Joomla with it. Good for setting up small store.
Subscribe to:
Posts (Atom)