ASP.NET MVC 1.0 Release Candidate Now Available

Posted By Venu Thomas

Today we shipped the ASP.NET MVC 1.0 Release Candidate (RC).  Click here to download it (note: the link just went live so if it isn’t working wait a few minutes for the server you are hitting to refresh).  It works with both Visual Studio 2008 and Visual Web Developer 2008 (which is free).

Today’s RC is the last public release of ASP.NET MVC that we’ll ship prior to the final “1.0” release.  We expect to ship the final ASP.NET MVC 1.0 release next month.

In addition to bug fixes, today’s build includes several new features.  It also includes some refinements to existing features based on customer feedback.  Please read the release notes that ship with the ASP.NET MVC download for full details on all changes.  The release notes include detailed instructions on how to upgrade existing applications built with the ASP.NET MVC Beta to the RC.

Read More.. 

AJAX Registration Page

Posted By Venu Thomas

Here AJAX Registration Page with HTML & Javascript. Checking username, length, password match..

live_previewLive Preview downloadDownload

$(document).ready() :

The most commonly used command in jQuery is $(document).ready(). It makes sure code is executed only when a page is fully loaded. We often place code blocks inside this $(document).ready() event.

?View Code JAVASCRIPT
 
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
 
// Your Code
 
$(document).ready(function()
 
{
 
// Put all your jQuery goodness in here.
 
}

Checking Username Length:

When guest types something in Username field less than 3 characters and focus move from it to next field. An error will be occurred .

username3

?View Code JAVASCRIPT
 
usr = $("#txt_username").val();
 
if(usr.length >= 3) //checking username length
{
	// Checking username code here..
}
 
else
{
	//Error Message code here..
 
}

Chekcing Username:

When guest types something in Username field greater than or equal 3 characters and focus move from it to next field Then, A waiting message will be displayed with small image as loader.gif.

checkingusername

?View Code JAVASCRIPT
$("#div_status").html('<img src="loader.gif" align="absmiddle">&nbsp;Checking username....');

If Username is available:

if username available from database. Ajax will display like this, Otherwise, An error will be occurred.

usernameready

?View Code JAVASCRIPT
	$.ajax({
    type: "POST",
    url: "check_username.php",
    data: "username="+ usr,
    success: function(msg){
   $("#div_status").ajaxComplete(function(event, request, settings){
 
	if(msg == 'OK')
		{
			// If the username available, goes here.
		}
		else
		{
			//If the username not available, goes here.
		}

Checking Password:

When guest types something in password field less than 3 characters and focus move from it to next field. An error will be occurred .

password3

?View Code JAVASCRIPT
 
var str_confirm_password = $("#txt_confirm_password").val();
 
if(str_password.length  >=3)
{
	// Checking Password match code here..
}
else
{
	// Error message code here..
}

Checking Password Match:

When guest types something in Password & Confirm Password fields, and focus move from it to next field. Then, it will check value of both fields. If both field’s value are not same then, an error will be displayed.

If not match

passwordnotmatch

If match

passwordready

?View Code JAVASCRIPT
var str_password = $("#txt_password").val();
var str_confirm_password = $("#txt_confirm_password").val();
 
if(str_password!=str_confirm_password)
{
	// If not match, goes here,
}
else
{
	//If match, goes here.
}

“Sign Up Now” Button :

When guest push “Sign Up Now!” button. It goes to next page .

?View Code JAVASCRIPT
function fn_onclick() {
	if(str_status == "OK" && str_pwd_status =="OK" && str_password != '' && str_confirm_password != '' )
	{
		$("#div_msg").html('<div id="logged_in"> <br />' +
    	 'Thanks for Registering <br />' +
   		  '<img align="absmiddle" src="loader_bar.gif">' +
    	 '<br /> Please wait while we redirect you to welcome page...</div>');
 
		setTimeout('go_to_next_page()', 4000);
	}
}
 
function go_to_next_page()
{
	window.location = 'welcome.html';
}

.removeClass() & .addClass() functions :

.removeClass() & .addClass() functions are used for add styles into username & password fields. In code, ‘css_ok’ & ‘css_error’ regarding from ‘style.css’ . For instance these functions show the box green if the values entered in the boxes are correct & otherwise red color

.

?View Code JAVASCRIPT
<link rel="stylesheet" type="text/css" href="style.css" />
 
	// Your code here..
 
$("#txt_username").removeClass('css_ok');
$("#txt_username").addClass("css_error");

In style.css,

.css_ok
{
border: 1px solid green;
color: #333333;
}
.css_error
{
border: 1px solid #AC3962;
color: #333333;
}

live_previewLive Preview downloadDownload

Security Audit Events in ASP.NET 2.0

Posted By Venu Thomas
Event Description
WebAuditEvent Base class for all audit events.
WebFailureAuditEvent Base class for all failure audit events, which are raised whenever a security action fails. ASP.NET 2.0 raises these events when URL or file authorization fails to authorize the request.
WebSuccessAuditEvent Base class for all success audit events, which are raised whenever a security action succeeds. ASP.NET 2.0 raises these events when URL or file authorization succeeds in authorizing the request.
WebAuthenticationFailureAuditEvent Base class for authentication failure audit events, which are raised whenever an authentication attempt fails. ASP.NET 2.0 raises these events when Membership providers or forms authentication fail to validate provided credentials, or when the forms authentication ticket fails to be decrypted or validated.
WebAuthenticationSuccessAuditEvent Base class for authentication success audit events, which are raised whenever an authentication attempt succeeds. ASP.NET 2.0 raises these events when Membership providers or forms authentication succeed in validating provided credentials.
WebViewStateFailureAuditEvent The class for the ViewState failure audit event, which is raised whenever ASP.NET fails to process the ViewState due to an encryption or validation problem.

Source : Click Here…

Download Multiple Files Into One ZIP File

Posted By Venu Thomas

How to Download Multiple Files Into One ZIP File

downloadDownload ICSharpCode.SharpZipLib.dll

Add this code as Class

using ICSharpCode.SharpZipLib.Zip;

Copy this code to your *.cs file

Pure Ajax in Asp.Net 4.0

Posted By Venu Thomas

Here is an interesting article on pure Ajax in Asp.Net 4.0.This article claims that the previous versions of Ajax is not partial post back.


Ajax Based Search Engine With PHP and XML

Posted By Venu Thomas

Here Sample code of Ajax based search engine with PHP and XML

live_preview Live Preview          downloadDownload Code

 

This is the Javascript Code :

?View Code JAVASCRIPT
/* &lt;--------------------------&gt; */
/* XMLHTTPRequest Enable		*/
/* &lt;--------------------------&gt; */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
 
var http = createObject();
 
/* &lt;--------------------------&gt; */
/* 		SEARCH				   */
/* &lt;--------------------------&gt; */
 
function fnSearchName() {
 
txtInput=encodeURI(document.getElementById('txtInput').value);
 
document.getElementById('divmsg').style.display = "block";
document.getElementById('divmsg').innerHTML = "Searching for <strong>" + txtInput+"</strong>";
// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'php_Search.php?name='+txtInput+'&amp;nocache = '+nocache);
 
http.onreadystatechange = fnSearchNameReply;
http.send(null);
}
function fnSearchNameReply() {
 
	var response = http.responseText;
	document.getElementById('divResult').innerHTML=response;
 
}

This is the PHP Code :

load("NameList.xml");
$x=$xmlDoc-&gt;getElementsByTagName('NAME');
for ($i=0; $i&lt;=$x-&gt;length-1; $i++)
{
//Process only element nodes
if ($x-&gt;item($i)-&gt;nodeType==1)
  {
  if ($x-&gt;item($i)-&gt;childNodes-&gt;item(0)-&gt;nodeValue == $q)
    {
    $y=($x-&gt;item($i)-&gt;parentNode);
    }
  }
}
$cd=($y-&gt;childNodes);
for ($i=0;$i&lt;$cd-&gt;length;$i++)
{
//Process only element nodes
if ($cd-&gt;item($i)-&gt;nodeType==1)
  {
  echo($cd-&gt;item($i)-&gt;nodeName);
  echo(": ");
  echo($cd-&gt;item($i)-&gt;childNodes-&gt;item(0)-&gt;nodeValue);
  echo("");
  }
}
 
?&gt;

Add/Remove NewLine in SQL Query

Posted By Venu Thomas

Add NewLine in SQL Query:

 
  Code:
Declare @FristName Char(10)
Declare @LastName Char(10) 
 
Set @FristName = 'Venu'
Set @LastName = 'Thomas' 
 
Select (@FristName + CHAR(13) + CHAR(10)+ @LastName) As Name
   

OutPut:

Name  
———————- 
Venu      
Thomas    

(1 row(s) affected)
 

Remove NewLine in SQL Query:

Code:


Declare @FristName Char(5)
Declare @LastName Char(10) 
Declare @strName Char(15) 
 
Set @FristName = 'Venu'
Set @LastName = 'Thomas'  
 
Set @strName =@FristName + CHAR(13) + CHAR(10)+ @LastName 
 
Select Replace(Replace(@strName, CHAR(13), ''), CHAR(10), ',') As Name
   

OutPut:

Name
————
Venu ,Thomas
(1 row(s) affected)

WCF vs Webservices

Posted By Venu Thomas

How to choose between ASP.NET Web Services and WCF Services for Services?

ASP.NET Web Services are a good choice for simple HTTP-based services hosted in IIS.

WCF is a good choice if you need the performance of TCP communication over HTTP or if

you need to host the service without a Web server. WCF provides support for WS*, which

includes support for end-to-end security and reliable communication. WCF allows you to

implement duplex communication, and you can also use it with Windows Message Queuing

and as a Windows service. In addition, you have more options with regard to protocols,

bindings, and formats. Keep in mind that WCF requires .NET 3.0 or higher.

Page 12 of 12« First...89101112