This is for improving knowledge of dot net technology, I have posted some articles related to Ajax, C sharp, vb.net, threading, linq, webservices, jQuery, Caching, .net Architecture, .Net Remoting, ADO.net, Authentication, ASP.net Overview, Debugger, Email integration, FTP, Payment Gateway, Performance and Scalability, Security, VS.net 2008, Web controls, Web Parts, WCF, WPF and SQL serve
Friday, June 5, 2009
ASP.NET Caching
Partial update of parent page via AJAX (ASP.NET 2.0) on close of a child window - conditionally
Introduction
At times, we are in situations where we need to open a child window, do some work on it, and then close it. Now, based on what was done on the child window, we may need to refresh the parent page or not. Now, not just refresh, a partial refresh! I have tried to demonstrate how we can pass on a value to a child, do something out there, and on saving it, we partially update the parent page. If nothing was done on the child window or the operation was canceled, then there would be no update of the parent page. This whole operation gives a good feel to the user, and the performance of the page would look a lot improved.
Background
We had a requirement in our project where we needed to update the parent page partially based on a particular value returned from the child window. Earlier, we were able to update the parent page, but all the time! Finally, after getting around the way described below, we were able to achieve partial update of the parent page only when required.
Using the code
For demonstration's sake, I had placed few Labels on the parent page. Couple of them inside the UpdatePanel and one outside it - just to keep an eye on the page getting partially updated whenever any update is done. The parent page ASPX looks like:
See full detail: http://www.codeproject.com/KB/ajax/AjaxUpdateParentPage.aspx?msg=3068586#xx3068586xx
Thursday, June 4, 2009
Integrating PayPal Payments into E-Commerce Applications with ASP.NET
Payment processing on the Web is a big market and there a myriad of services and providers that allow you to process credit cards and bank cards over Internet connections. Most of these services are using credit card processing that automates the process of credit card validation. These providers usually provider either HTML or API based interfaces to process credit cards. HTML based interfaces provide you with a URL your application can redirect to on the provider’s site, which then handles the actual payment processing. API based interfaces allow your application talk directly to the provider’s services so that the payment processing can be integrated into your own application.
If you’re running your own E-Commerce applications you generally will want to use an API so the payment processing can be directly integrated into your own application. This makes sure the user of your app sees a consistent Web interface – as far as the user is concerned they are never leaving your site, but rather your Web backend is making the remote calls against the payment processing service and simply returning the success or failure of the request. HTML based payment interfaces generally look unprofessional as the user is whisked off to some other site for payment processing. Using external HTML processing often also requires you to handle inventory and order management through the payment provider which can be hassle especially if your e-commerce app already handles this. Still HTML based interface are popular because they can often be driven from non-data driven site and thus mitigate all the order management to the processing provider’s servers which can be beneficial for small sites.
Why PayPal?
On my own Web Site’s West Wind Web Store I use API based processing with Authorize.NET to perform most payment processing. This works great is fast and provides an integrated mechanism that provides seamless integration. We sell our software products online and from time to time there are those customers that are still squeamish about using their credit cards online – often customers from Europe – that would rather use an alternate payment mechanism. So a while back I looked at integrating PayPal into my store software.
PayPal may not be the first choice for order processing in a custom e-Commerce application, but it does provide another payment option for your customers. Some customers (at least in my business) are notoriously difficult in finding the ‘right’ payment mechanism and PayPal has been the answer for me in a number of cases, which is why I eventually sat down and integrated it into my Web Store application.
I've actually been surprised how many orders I get in my store through PayPal. When I originally hooked this up a few months back I thought of it more of a novelty and another bullet item for the store software, but there are quite a few people left in this world who don't trust the Internet (or the vendors for that matter) with their credit cards. PayPal is nice in that respect in that they provide the ability to keep the credit card from any vendor at all - now you just have to worry that PayPal stays safe and honest.
On the merchant front too I've found a lot of people actually using the PayPal functionality as their main payment mechanism instead of merchant services. A lot of small operations or personal sites don't want to deal with merchant services it seems. I can't blame them - most merchant providers or at least the 'resellers' are crooks trying to make a quick buck of the unsuspecting vendor. Getting set up also takes some amount of paperwork and often can take weeks. Luckily that seems to be changing somewhat with better and more consistent gateway services appearing with reasonable prices (my experience with MerchantPlus and Authorize.Net has been a real joy actually). Still, with PayPal you hit the ground running as soon as you have configured your account and provided a bank account.
On the downside, PayPal is a purely Web based interface. If you need to integrate payment processing into a non-Browser based application, PayPal is not an option since PayPal works exclusively through the Web browser interface. So if your business also takes phone orders and has an offline POS system, PayPal will be a hassle as you'd have to enter orders on the Web. PayPal also has rather high sales percentages that are generally much higher than merchant accounts (unless you are super high risk). Be sure you do the math. A little time up front may save you a lot of money in the long run - percentages are what often make or break your sales margins.
PayPal acts as a middle man between the buyer and seller so that the seller never has to expose his payment information to the seller directly. Instead the buyer registers his credit card or bank account with PayPal and maps his account to an email address and then uses PayPal to make purchases. The advantage here is that the seller never gets the buyers payment information and therefore can’t abuse it (accidentally or otherwise) in any way..
So what do you need to accept payments? The nice thing about PayPal is that it’s easy to sign up to accept payments. If you already have a PayPal account you use for buying things online, then you are already set up to also receive payments. All you need to have a bank account so payments can be deposited into it. That’s it!
How PayPal works
PayPal is not a payment gateway and they don’t provide a direct API interface to their service, except for very large/high volume customers. Rather, like the HTML based services I mentioned earlier, the buyer has to go to the PayPal site, login and accept the payment request. However, this process can be automated to some extent by configuring PayPal to return to specific URLs in case of success or failure and providing a callback confirmation Url that allows you to verify that PayPal processed a payment on your behalf. This configuration is done via POST data or QueryStrings passed to the PayPal pages.
In my Web Store I want PayPal to process only my final order amount. PayPal supports a number of order and inventory management features, but in an e-Commerce site scenario such as mine, all of this handled by my own Web application – all I want PayPal to do is process the final order amount.
As you might expect from this description this process is fairly involved if you want to completely integrate the payment into the application. The process goes like this:
- User picks items in our store Web site
- User fills out order info and goes to our store’s order page
- We provide the order total
- User accepts the order of multiple items and final amount
- User selects PayPal as payment
- User gets redirected to the PayPal site
- PayPal site takes user through the payment process
- On Success PayPal redirects back to our order confirmation page
- On Failure PayPal redirects back to our order form (redisplays order info)
- Finally we need to confirm to PayPal that we want to process this orderand PayPal confirms to us that the order went through.
See full detail: http://www.west-wind.com/presentations/PayPalIntegration/PayPalIntegration.asp
Credit Card Validator control for ASP.NET
A while ago I started working on converting an eCommerce payment gateway's (DataCash) COM server to a native .NET assembly using their XML API. Once I had got a basic version working I decided to produce a simple web form to test it out, and so opened it up for all comers (and received some very generous donations from CP members -- thanks guys :). As part of this web form I wanted to include support to check that users had entered a card number, expiration date etc., and then wanted to extend it further to include support for checking that the card number was valid before issuing a request to the payment gateway's server. This is the result, a drop-in replacement for any of the other validation controls.
Incidentally, you can see a demo of the validator in use (as well as the card payment gateway assembly) at the following address: https://ssl500.securepod.com/oobaloo/DataCash/, besides this you may also be interested in the everything you ever wanted to know about CC's guide.
Before getting into any of the implementation details here is a simple UML class diagram to show the rough layout of the Control.
see full detail: http://www.codeproject.com/KB/validation/creditcardvalidator.aspx
Integrating Electronic Payment Processing into ASP.NET Web Applications
The process of taking electronic payments from customers and getting the money deposited into your own accounts is a winding one, with several levels of providers being part of the transaction process. Figure 1 shows an overview of the process and the entities involved.
See full detail: http://www.west-wind.com/presentations/aspnetecommerce/aspnetecommerce.asp
Wednesday, June 3, 2009
Live Data Binding using ASP.NET AJAX 4.0
Many of you may already be familiar with the upcoming version of ASP.NET AJAX, version 4.0. The release was out on March 12, 2009. The key features for this version are:
- ADO.NET Data Services support
- WCF and ASMX Web service integration
- ASP.NET AJAX Client Templates
- Declarative instantiation of client-side controls and behaviors
- Observable pattern for plain JavaScript objects
- Live Bindings
- Markup Extensions
- DataView control and DataContext component
- Command Bubbling
- Change tracking and identity management
- Support for managing complex links and associations between entities from multiple entity sets or tables
- Extension methods allowing change tracking and read-write client-server scenarios using other JSON services, including RESTful or JSONP based services
What is Live Binding?
Live binding is having the data bound in real-time. Meaning when there's any change in the data source, the changes are reflected to the data bound interface instantly and vice versa. For example if you have an interface component, like a table, bound to a data source, like an array, any change to that array from the code is reflected in the view table instantly. If you are using an edit template for updating the data of a selected row of the table, the data in the table will get updated as you change a field in your edit form if both the table and the form use "Live Binding".
span >Pretty cool, right?
Inside Live Binding
This is all done through client-side script, JavaScript. But how does it come in action? The core of the live binding is the implementation of an "Observer" pattern. The observer pattern enables an object to be notified about changes that occur in another object. This is not an event handler based pattern which we often misuse as an observer pattern. ASP.NET AJAX 4.0 implements this pattern completely. It adds observer functionality to ordinary JavaScript objects or arrays so that they raise change notifications when they are modified through the Sys.Observer interface.
Live Binding in Action
To implement live binding, you will need the ASP.NET AJAX 4.0 framework included in your file. After downloading from here, you'll need to reference them to your file. You can use a conventional
see full detail: http://dotnetslackers.com/articles/ajax/Live-Data-Binding-using-ASP-NET-AJAX-4-0-Preview-4.aspx
.NET 4 Revealed
The updated framework promises maturing class libraries and new parallelism capabilities to facilitate the development of components that can take advantage of the intensive I/O capabilities of multi-core systems.
The updated framework promises maturing class libraries and new parallelism capabilities to facilitate the development of components that can take advantage of the intensive I/O capabilities of multi-core systems.
"With 4, I see less new things and more of an extension in terms of beefing up what's there-the Windows Communication Foundation, Windows Presentation Foundation, Workflow services," says Mark Driver, vice president of research at Gartner Inc. "I don't see a whole lot of new APIs but rather the evolution of the APIs that they introduced as part of 3.5."
See full detail: http://adtmag.com/articles/2009/06/02/net-4-revealed.aspx
Speed Up Your Site With AJAX
The benefits are obvious to Fairytale Brownies in Chandler, Arizona, which recently implemented AJAX to speed up the checkout process on its site. Founded in 1992 by childhood friends Eileen Joy Spitalny and David Kravetz, both 40, Fairytale Brownies is the nation’s leading purveyor of mail-order gourmet brownies, with 2007 sales projections of $8.9 million. When the company recently redesigned its website to make its brownies look more appealing, it used AJAX to speed up the gift list checkout section.
“This gift list shows our customers who received gifts from them before,” explains Spitalny. “It’s a very popular feature, but we wanted to make it as quick and easy to use as possible.”
Before AJAX, any change to addresses, ship dates, quantities or gift messages meant waiting for entire web pages to reload. But AJAX loads pages only once; changes need only small data updates. This translates into a smoother process that benefits not only customers, but also employees, who spend less time on the phone with customers.
Fairytale employed an outside consultant to implement AJAX. Spitalny suggests finding a programmer who is familiar with JavaScripting and XML. She also suggests a visit to http://ajax.asp.net, a Microsoft site that provides free tutorials and starter kits to help programmers understand the technology.
See full detail: http://news.alibaba.com/article/detail/technology/100109433-1-speed-up-your-site-ajax.html
Tuesday, June 2, 2009
Web Paging Navigation Control
this web paging control for navigation in data list.
how to use this control
1-Set Control setting in page load 2-to get page index from this control use PagingControl1_PageIndexClick(object sender, EventArgs e) event
Sample for how to use this control
See full detail:http://www.c-sharpcorner.com/UploadFile/Nesreeen/WebPagingControl05182009155353PM/WebPagingControl.aspx
Using the Backgroundworker with VB.Net 2005
See full detail: http://www.vbdotnetheaven.com/UploadFile/ffortino/Page105242009222549PM/Page1.aspx
Monday, June 1, 2009
Client-side Data Binding in ASP.NET AJAX 4.0
As you may be aware, the first release of ASP.NET AJAX had a supplemental futures release that contained an implementation of declarative instantiation and client binding, so we always knew this was coming. However, the earlier implementation was based on XML and required that the user insert a script element marked with the type=’text/xml-script’ attribute below the HTML for the page. While initially very promising, this technique had several drawbacks including its verbosity, its dependence on a client XML parser, and performance issues. Finally in version 4.0, we have a completely new implementation that doesn’t suffer from any of these limitations, and looks to be really useful and easy to use.
This article is based on the preview 4 release of ASP.NET Ajax available for download at http://www.codeplex.com/aspnet/, and thus the details of some features explained here are subject to change before the final release.
DataView and client templates
We will start with a simple example that demonstrates how to associate an array of items in JavaScript with a client template. The core mechanism for client data binding and templating is a client-side class named Sys.UI.DataView. This class inherits from the Sys.UI.Control class which defines a mechanism for associating with an HTML element in the DOM, and it also defines several properties and methods including the data property which can be initialized with an array of data to bind to a template. The page below uses the DataView class to associate a list of courses and their codes to an HTML table template (note we are manually including the script files for ASP.NET Ajax 4.0 – these will be included through the standard ScriptManager control in the final release).
See full detail: http://www.pluralsight.com/main/whitepapers/ClientDataBindingAjax4.aspx