Showing posts with label ASP.NET. Show all posts
Showing posts with label ASP.NET. Show all posts

New Features in ASP.NET 3.5  

ASP.NET AJAX

With ASP.NET AJAX, developers can quickly create pages with sophisticated, responsive user interfaces and more efficient client-server communication by simply adding a few server controls to their pages. Previously an extension to the ASP.NET runtime, ASP.NET AJAX is now built into the platform and makes the complicated task of building cross-platform, standards based AJAX applications easy.


New ListView and DataPager Controls

The new ListView control gives you unprecedented flexibility in how you display your data, by allowing you to have complete control over the HTML markup generated. ListView‘s template approach to representing data is designed to easily work with CSS styles, which comes in handy with the new Visual Studio 2008 designer view. In addition, you can use the DataPager control to handle all the work of allowing your users to page through large numbers of records.


LINQ and other .NET Framework 3.5 Improvements

With the addition of Language Integrated Query (LINQ) in .NET Framework 3.5, the process of building SQL queries using error-prone string manipulation is a thing of the past. LINQ makes your relational data queries a first-class language construct in C# and Visual Basic, complete with compiler and Intellisense support. For Web applications, the ASP.NET LinqDataSource control allows you to easily use LINQ to filter, order and group data that can then be bound to any of the data visualization controls like the ListView and GridView controls. In addition, all the other improvements to .NET Framework 3.5, including the new HashSet collection, DateTime offset support, diagnostics, garbage collection, better thread lock support, and more, are all available to you in your ASP.NET applications.


WCF Support for RSS, JSON, POX and Partial Trust

With .NET Framework 3.5, Windows Communication Foundation (WCF) now supports building Web services that can be exposed using any number of the Internet standard protocols, such as SOAP, RSS, JSON, POX and more. Whether you are building an AJAX application that uses JSON, providing syndication of your data via RSS, or building a standard SOAP Web service, WCF makes it easy to create your endpoints, and now, with .NET Framework 3.5, supports building Web services in partial-trust situations like a typical shared-hosting environment.

Read More...

Reading a text file in ASP .NET using VB (Visual Basic)  

We require the namespace, System.IO to work with files. So, we should import this namespace in our ASPX page such as

<%@ Import Namespace="System.IO" %>

To start with, we need to create an instance of the object, StreamReader. The instance will be the file pointer for us. Once we have a File Pointer, we need to invoke the method, OpenText method of the object, File. The method, OpenText takes a string as an argument. The string is nothing but the path of file that is going to get created. Now, let us see an example. Let us assume, we have a textbox with textmode set to MultiLine and a button. On the click event of the button, we need to read the text file. The code within the Click event is shown below.

Code in the OnClick event of button.
Sub WriteToFile(sender As Object, e As EventArgs)

Dim fp As StreamReader

Try
fp = File.OpenText(Server.MapPath(".\Upload\") & "test.txt")
txtMyFile.Text = fp.ReadToEnd()
lblStatus.Text = "File Succesfully Read!"
fp.Close()
Catch err As Exception
lblStatus.Text = "File Read Failed. Reason is as follows " & err.ToString()
Finally

End Try

End Sub

Read More...

What is ASP.NET AJAX?  

ASP.NET AJAX refers to new components in ASP.NET that allow for building rich AJAX styled web applications using the design patterns familiar to ASP.NET developers. ASP.NET AJAX 1.0 was available as a separate add-on for ASP.NET 2.0. With the release of ASP.NET 3.5, the AJAX components have been integrated into ASP.NET (no separate download required).

AJAX components in ASP.NET integrate cross-browser script libraries with the ASP.NET server side Web application framework. This integrated architecture empowers developers to rapidly create pages with sophisticated, responsive user interfaces and more efficient client-server communication by simply adding a few server controls to their pages.

ASP.NET AJAX allows developers to choose their preferred method of AJAX development, whether it is server-side programming, client-side programming, or a combination of both.

Server-side AJAX Programming

Developers familiar with ASP.NET's server-side programming model can add AJAX functionality using the familiar server controls, and the convenient drag and drop gestures. For example, partial update functionality can be added to ASP.NET applications by wrapping sections of their websites in the AJAX server control 'UpdatePanel', which enables the server controls to update without a post back. This is as simple as AJAX programming gets. Developers don't have to learn about the underlying scripting or browser technologies. Based on the ASP.NET server side design patterns, developers continue to get key advantages such as a clean declarative model of specifying web page UI, an event-driven programming model, and a rich set of APIs from the .NET Framework.

Client-side AJAX Programming

Developers with a basic understanding of JavaScript can leverage client-side AJAX framework, that allows building client centric AJAX applications. For example, the client AJAX Framework allows developers to build rich client side components and controls and make calls to remote servers, including web services and then updating the Web page with the response. The response can be an HTML snippet or an XML document, allowing for simple or extensive updates to the Web page.

The Client side AJAX Framework works well with ASP.NET. The ASP.NET team also ships this framework independently as Microsoft AJAX Library. Since this framework is not tightly coupled with ASP.NET, it can be used with other server side technologies as well such as PHP and Cold Fusion.

ASP.NET AJAX Programming

ASP.NET AJAX shines in its ability to combine the best of server-side and client-side AJAX programming, providing Web applications with a user experience similar to the richness of traditional desktop applications. Watch some of the following videos to learn how simple it is to get started with ASP.NET AJAX programming.

Read More...

Classic ASP versus ASP.NET  

The earliest non-static Web sites were built using the Common Gateway Interface (CGI). CGI processed requests directly, issuing responses by firing up a custom process to handle incoming HTTP requests. The next step in improving Web site performance was to process HTTP requests through DLLs, which are much less expensive than loading new processes. On the Windows platform, these are known as ISAPI DLLs which are customized to spit out HTML specific to the task.
ASP was introduced because the process of writing ISAPI DLLs was burdensome. Think of classic ASP as one big ISAPI DLL that Microsoft has already written for you. Classic ASP accepts HTTP requests and posts back responses. You control the content coming from ASP using ASP code. ASP parses files with .ASP extensions and does its best to emit the right kind of HTML. Classic ASP pages include both raw HTML and script blocks. Accessing the HTTP requests and responses at runtime is possible because the requests and responses are wrapped in well-established objects you can access from the script blocks.
Classic ASP goes a long way towards simplifying Web programming. It's often much easier to write some HTML and mingle it with some script than it is to write a new DLL from scratch. But classic ASP is not without its issues. First, ASP code is often without structure. It's very much like the early days of BASIC programming where you could get something done quickly, but the resulting code was often too difficult to follow.
ASP.NET is the evolution of ASP. For example, you still have the same intrinsic objects in ASP.NET and you can add scripting wherever you want on the page. In fact, most ASP pages can be run as ASP.NET pages with no problem.
But ASP.NET brings a lot of new stuff to the table. First, ASP.NET supports every .NET-compliant language. No longer are you confined to using JScript® or VBScript on your Web pages. ASP.NET lets you write the executable parts of your pages in C# or Visual Basic (or COBOL). Second, ASP.NET is compiled into assemblies just like the other languages in .NET. This provides both enhanced performance and security benefits.

Read More...