Search This Blog

Saturday, October 27, 2012

How to redirect users from domain.com to http:www.domain.com

Here is the answer.


Use .htaccess file in the root directory.

open notepad.exe and create file name .htaccesss


in that file write code


RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^$ http://www.mydomain.com/index.html [L,R=301]



NOTE : FILE MUST BE PUT ON THE ROOT DIRECTORY AND MUST HAVE NAME AS .HTACCESS

Friday, October 19, 2012

Introduction to JQuery

Definition of Jquery 

Jquery : It is a scripting language based on javascript, which contain rich set of built in function so it is very easy to use the jquery in your website. 
                We can create animation on the webpage with the help of jquery. we can also add some interactive programming effects which user wants to see on the webpage using jquery. Now a days jquery is one of the popular scripting language. 

Here some examples are given to show the use of jquery on the website.

Hide and show division or whatever in the division tag like if you want to hide the image then put it inside the division tag.
Division id is #divSample

1000millisecond will taken to show the output on the screen. YOu can change the  Time according to your need into the webpage or web application.

.aspx File

<script type="text/javascript">
  function showbtn()
  {
      $('#divSample').show(1000); 
  }

  function hidebtn()
  {
      $('#divSample').hide(1000); 
  }
</script> 

<body>
<div id="divSample" >
<img src="Image1.jpg" height="200px" width="200px" title="jquery" text="ShowImage" />
</div>
<asp:Button id="b1" runat="server" onclientclick="showbtn();">
</asp:Button>
<asp:Button id="b2" runat="server" onclientclick="hidebtn();" text="HideImage">
</asp:Button>
</body>


The output is wonderful.
so try it your self with littlebit work on this code and you can create innovation in your technology.

I had brief out some other function which can be used as above.

 $('#divSample2').slideUp(2000); 
            
 $('#divSample2').slideDown(2000);


 $('#divSample3').fadeOut(2000); 
            
 $('#divSample3').fadeIn(1100);


Animation with the use of JQuery.

YOu can also create animation with the help of animate function.


$("#divSample").animate({height:500, width:750 , opacity: .7}, 3000, function() {alert("DivSample is having 500px height and 750px width"); });


This will create your division of image large upto 500px height and 750px width.
and after completion of it with opacity of 70%.
 It displays the message that DivSample is having 500px height and 750px width
in the Alert box.
                

Thursday, October 18, 2012

What is JQuery ??? How to use it with Asp.net???

I think you all have to know little bit about the new invention in Technology.or How to use that with the Asp.net.

"JQuery is a cross browser JavaScript library that helps to traverse through HTML elements, event handling, effects(animation) and Ajax interactions."

It is very easy to learn and implement features in out application with the help of JQuery.

Here is Sample Example is given related to it.

Add Script tag into .aspx File for using JQuery on to the Webpage.


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js">  
</script>

OR aspx.cs File 

protected override void Render(HtmlTextWriter writer)
{
this.Page.ClientScript.RegisterClientScriptInclude("jQuery", "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js");
base.Render(writer);
}

e.g. Display "Hi, Hitesh!" message on the webpage.

.aspx file : 
        
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
            
            <script type="text/javascript">
            function hi()
            {
                $("#divSample").append("Hi, Hitesh!");
            }
            </script>

        </head>
        <body>
            <form id="form1" runat="server">
                <div id="divSample">
                </div>
            </form>
        </body>
        </html>
        
And Aspx.cs File
            
protected override void Render(HtmlTextWriter writer)
 {
 this.Page.ClientScript.RegisterClientScriptInclude("jQuery", "http://ajax.google  apis.com/ajax/libs/jquery/1.2.6/jquery.min.js");
 this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "startup", "<s  cript type=\"text/javascript\">hi();</script>");
 base.Render(writer);
}




Tuesday, October 9, 2012

New features of asp.net 4.5 vs 4.0 framework


1. Asynchronously Reading and Writing HTTP Requests and Responses while in asp.net 4.0 it happens synchronously.
ASP.NET 4 introduced the ability to read an HTTP request entity as a stream using the HttpRequest.GetBufferlessInputStream method. This method provided streaming access to the request entity. However, it executed synchronously, which tied up a thread for the duration of a
request.ASP.NET 4.5 supports the ability to read streams asynchronously on an HTTP request entity, and the ability to flush asynchronously. ASP.NET 4.5 also gives you the ability to double-buffer an HTTP request entity, which provides easier integration with downstream HTTP handlers such as .aspx page handlers and ASP.NET MVC controllers.

2.Support for await and Task-Based Asynchronous Modules and Handlers
The .NET Framework 4 introduced an asynchronous programming concept referred to as a task. Tasks are represented by the Task type and related types in the System.Threading.Tasks namespace. The .NET Framework 4.5 builds on this with compiler enhancements that make working with Task objects simple. In the .NET Framework 4.5, the compilers support two new keywords: await and async.

3.Support for WebSockets Protocol
WebSockets protocol is a standards-based network protocol that defines how to establish secure, real-time bidirectional communications between a client and a server over HTTP. Microsoft has worked with both the IETF and W3C standards bodies to help define the protocol. The WebSockets
protocol is supported by any client (not just browsers), with Microsoft investing substantial resources supporting WebSockets protocol on both client and mobile operating systems.WebSockets protocol makes it much easier to create long-running data transfers between a client and a server. For example, writing a chat application is much easier because you can establish a true long-running connection between a client and a server.

4.Bundling and Minification
Bundling lets you combine individual JavaScript and CSS files into a bundle that can be treated like a single file. Minification condenses JavaScript and CSS files by removing whitespace and other characters that are not required. These features work with Web Forms, ASP.NET MVC, and Web Pages.

5.Performance Improvements for Web Hosting
The .NET Framework 4.5 and Windows 8 introduce features that can help you achieve a significant
performance boost for web-server workloads. This includes a reduction (up to 35%) in both startup time and in the memory footprint of web hosting sites that use ASP.NET.

6.Unobtrusive Validation
You can now configure the built-in validator controls to use unobtrusive JavaScript for client-side validation logic. This significantly reduces the amount of JavaScript rendered inline in the page markup and reduces the overall page size.

7.Provides HTML editor, Javascript Editor and CSS editor with smart and intelligent features.