Banner Ad

Saturday, March 8, 2014

Using MSCaptcha

By Francis   Posted at   9:08 PM   MSCaptcha No comments

                                    Recently, in one of my project I need a captcha for my application. Just a google search provides number of options. I need a open source solution, so I go with krisanov’s solution. I just download and try to using that on my project. However it doesn’t works fine. Just follow the instruction mention by mudasar in this url. But I have encountered several problems (that is it doesn’t display any captcha image) the when I added that into my project, which leads to write this post.

Below are the steps that I have followed:

 

1) Just download the captcha from the url.

2) Add the reference into the project by “Right Click on the Project –> Add Reference”.

3) After that you need to include the below lines into web.config file:

 

<system.web>
    <httpHandlers>
        <add verb="GET" path="CaptchaImage.aspx" type="WebControlCaptcha.CaptchaImageHandler, WebControlCaptcha"/>
    </httpHandlers>

</system.web>
<location path="CaptchaImage.aspx">
    <system.web>
        <authorization>
            <allow users="*"/>
        </authorization>
    </system.web>
</location>

 

What previously done, I have missed out entire “location” element, which is also not mentioned in the mudasar’s tutorial. I have found this solution in this asp.net forum thread.


Hope this helps to someone!

Wednesday, March 5, 2014

VisualStudio Tips & Tricks - 7 : Using Transact-SQL Editor in Visual Studio 2010

By Francis   Posted at   10:13 AM   Visual Studio Tips and Tricks No comments
                           Few months ago, when we upgrade from VSS to TFS, somehow we lost intellisense in SQLServer Management studio 2008 R2. We struggle a lot to obtain. But no luck till now. However, currently we are using Visual Studio 2010, which enriched with lot of futures.
            Instead of using SQL Server Management, what I did was open the SQL file using Visual Studio 2010. In Visual Studio, Right click on the Menu bar, from the floating menu “check” the “Transact-SQL Editor”.

image
Now we got the toolbar available in SQL to do some basic operations like connect the SQL Server, Execute the Transact SQL etc., The main benefit in this approach is the intellisense works fine with in the “Transact-SQL Editor”. So my problem solved temporary.
One of the main attraction in this feature is, we can do all basic operations with in this editor. However, I’m not at all a DBA, just a developer who used SQL server as a backend. This is more convenient way work as of now.

Hope this may help to some one!!

Tuesday, March 4, 2014

Visual Studio Tips & Tricks – 6 : Multi-Copy functionality in Visual Studio

By Francis   Posted at   12:26 PM   Visual Studio Tips and Tricks No comments

                                    Some time we may need to copy the multiple code snippets (that is we may need to copy and paste lines that are not in order) in a file and paste it in another location of the file inside Visual Studio. For example, we have 5 lines of text, what we need is to copy the 1,3 and 5 line of text and paste it on some other location. To achieve that functionality to do the following:

 

1) Copy the code snippets using Ctrl+C key combination. (That is select the line 1 and press Ctrl + C and select line 3 press Ctrl + C and so on).

2) When you paste that code press the key combination Ctrl + V + Shift key, which rotates the copied lines of text. To paste a particular selected text just press Ctrl + V.

 

Hope this helps to some one!

Tuesday, February 4, 2014

Daily Interview Question #6: What are the different types of Constructor in C#?

By Francis   Posted at   1:03 PM   C# Interview Questions No comments

Below is the list of Constructors available in C#:

1. Default Constructor

2. Parameterized constructor

3. Static Constructor.

 

By default constructor have “public” as access specifier. A class can have more than one Constructor. In C# “this” keyword is used to access the constructor from another constructor. By default, C# will provide a default constructor if no constructor declared.

 

Hope this helps!

Monday, February 3, 2014

Attach Javascript to Button

By Francis   Posted at   2:01 PM   No comments

In this tutorial I’m going to explain how to add a javascript snippet to the ASP.Net server side Button Control.

 

Code:

Copy the below code in an .aspx file:

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:Button runat="server" ID="btnSubmit" Text="Click Me" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>


 


Copy the below code in an .aspx.vb file:

 
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
btnSubmit.Attributes.Add("onclick", "alert('Button Clicked');return false;")
End Sub


Explanation:


The above code add “onclick” attribute to the Server side button “btnSubmit”. The attribute value is just a javascript snippet, which just show an alert box.


 


Take a look, after the alert we specify the “return  false;” which avoid the webform to be refreshed.


 


Hope this helps!

Connect with Us