Javascript showModalDialog() Function
In Web application we can use window.showMadalDialog() to popup a modal window. Now let's take a deep look at how to use this function. 1. Syntaxvar vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures]);parameters description:sURL - required. data type : string. It refer to the URL of target ducument to link to.vArguments - optional. data type : variant. It can be an object, an array. It is used to pass value to the target document. Using window.dialogArguments to retrieve the
prevent a Javascript Modal Window to open itself in a new window
I used window.showModalDialog() to open a modal window in my ASP.Net web application. When I click a Button control to do something, the page is postback, and this made the modal window reopen a new window for the page. This is not what I excpected.To prevent this unexpected action, you need to add the following html code inside <head> section of your ASP.NET page.<base target="_self" />If your page use a master page, you should definde a ContentPlaceHolder under <head&g
Managing Namespaces in VB.Net
A namespace is a way to disambiguate one public interface from another. You can happily go through life not worrying about explicitly declaring namespaces in your VB.Net code because of VB.Net's automatic namespace creation. So you can create a project, give it a name, and start writing code. Beautiful and blissful.Then one day, you wake up and the solution your team works on won't compile.This will happen to you as a result of not managing your projects' namespaces properly. Eventually, you wil
Set a Datasourse List for Excel cells
Sometimes, you want the value of an Excel cell coming from a data list preseted. see the figure below: Now follow me to set a data list for excel cells. 1. Select a cell you want to set data list. 2. Click "Data" main menu. 3. Click "Data Validation" button. 1. On the "Data Validation" window,select "Settings" Tab. 2. Select "List" from "Allow" dropdownlist, and make sure "Ignore blank" and "In-cell dropdown" check
SQL Server 2005 Developer Edition English Version Setup on Windows 7
In the recent project, our customer required to use MS SQL Server 2005 English Version as the database backend. I try to install it on my machine which is Windows 7. Follow the setup wizard, and on the "System Configuration Check" screen , there is a waring says "ASP.Net Version Registration Requirement", click the "Message" link you will see the detail: "Failed to find the ASP.Net Version Registration with Microsoft Internet Information Services (IIS)." I
Using Excel to generate Inserts for SQL Server
Much of my day job involves database design, maintenance and manipulation. I use SQL scripts to quickly build my databases from scratch. In order to test them I need piles of data and find it is often too much work to generate all those inserts manually or figure out sqlcmd or osql code to import bulk data.The best programmers, as many say, are lazy and the quickest way I’ve found to generate the inserts is to use Excel. If any of the following isn’t clear please attach a comment and I’ll be
Building a Pub/Sub Message Bus with WCF and MSMQ
In my previous blog I demonstrate how to build a offline distributed system with MSMQ. In this blog I will show you how to build a Publish/Subscribe message bus using WCF and MSMQ. The solution is built with .NET Framework 3.0 and makes extensive use of Windows Communication Foundation (WCF), Microsoft Message Queuing (MSMQ) 4.0 and Internet Information Services (IIS) 7.0, all hosted on Windows Server 2008. Now follow me.1. Defining the Service ContractThe first step was to define the contracts
Push Data From Server to Silverlight Clients With a WCF Duplex Service
Normally in a client-server architecture application, the client makes a request to the server, then the server responses to the client. The client side PULLs data from the server side. However, we sometimes want the server side to PUSH data to the client side whenever the data changed. With a WCF duplex service, we can push updated data to Silverlight clients. In the rest of this blog I will show you how to achieve this goal.Many of the WCF services out there follow the simple request-response
Reading message from nontranscational remote MSMQ in workgroup
MSMQ is very useful for building a distributed, offline application. In my recent project the customer requires reading message remotely from a MSMQ queue. In this blog I will show you the solution.1. MSMQ API Get StartedAccessing MSMQAccessing a queue via .NET is done with the System.Messaging.MessageQueue object. The following code demonstrates how to access a public queue named TechRepublic on a computer named "SRV-MESSAGING":MessageQueue queue = new MessageQueue("SRV-MESSAGING
WCF Services Sample: Authenticate Silverlight Client based on Custom Security Token
In my blog "WCF Services Sample: Authenticate Silverlight Client based on UserName and Password", I show you how to improve security of WCF security by using a custom validator to authenticate Silverlight client based on username and password. That solution look good. However, it is not a final solution. You know, the Silverlight application runs on local machine of the remote users. The Silverlight communicate with WCF service via BasicHttpBinding, which transfer messages in cleratext
WCF Extension : Inject and Inspect Custom Message
While working with WCF, we often need transfer some kind of data in message headers. For example, in order to authenticate the caller of WCF service, we need pass username and password into the message header, then in the service side retrieve them and validate them. But how can we inject a custom message on WCF client side and retrieve it on WCF service side? The key is System.ServiceModel.Dispatcher.IClientMessageInspector and System.ServiceModel.Dispatcher.IDispatchMessageInspector. To learn
WCF Services Sample: Authenticate Silverlight Client based on UserName and Password
In the <<WCF Sevices Sample>> series, I have gone through WCF service creation, hosting, transport protocol supporting. By now our service can be accessed by anyone from anywhere, because we did not authenticate the service caller. The Windows Communication Foundation (WCF) provides many choice for us on service security. For more information about this subject, please refer to MSDN.In this blog I'd like to talk about WCF service authentication based on username and password. I'd lik
WCF Services Sample: Config WCF services over HTTPS only
In my previous blogs I have introduced how to create a WCF service and host it in IIS, and config it over both Http and Https. In this blog I would like to move forward -- config the service work over only HTTPS. I will still use that sample project.1. Setup Web Application with SSL RequiredOpen the IIS Manager, Select "ServiceHost" web application under the default web site as shown below.Double-click "SSL Settings" on the right frame, the "SSL Settings" window is
WCF Services Sample:Config over both HTTP and HTTPS
In my blog "WCF Services Sample: create a Silverlight client application", I show you how to config WCF service and Silverlight to communicate over HTTP. In this blog I will introduce how to config WCF service over both HTTP and HTTPS. I still use that sample project in this blog.1. Setup IIS to Enable SSLBefore WCF service can work over HTTPS, we must setup IIS to enable SSL. I have talked about this subject in my another blog, please refer to it for more details.2. WCF Service Config
WCF Services Sample: create a Silverlight client application
In my previous blog, I created a WCF service and hosted it in IIS. In this blog I will create a Silverlight client application to call that service, and host the Silverlight client in a ASP.Net web application.1. Create a Silverlight ApplicationRight click the solution in the Solution Explorer, Add -> New Project. In the window below, select "Silverlight" as Project Type, select "Silverlight Application" Template, input project Name and Location, then click "OK".
WCF Services Sample: Create and Host a Service in IIS
In this blog I will show you how to create and host a WCF services from scratch.1. Define the Services ContractOpen Visual Studio 2008, File -> New -> Project. It will open the "New Project" window for you. Select "Web" under the "Visual C#" on the left treeview "Project types", then select "WCF Service Application" under the "Templates" on the right side window. Input the project Name and Location,check "Create dictionary fo
WCF Essentials (5)
11. WCF ArchitectureWCF offers immensely valuable support for reliability, transactions, concurrency management, security, and instance activation, all of which rely on the WCF interception-based architecture. Having the client interact with a proxy means that WCF is always present between the service and the client, intercepting the call and performing pre- and post-call processing. The interception starts when the proxy serializes the call stack frame to a message and sends the message down a
WCF Essentials (4)
9. EndpointsEvery service is associated with an address that defines where the service is, a binding that defines how to communicate with the service, and a contract that defines what the service does. This triumvirate governing the service is easy to remember as the ABC of the service. WCF formalizes this relationship in the form of an endpoint. The endpoint is the fusion of the address, contract, and binding.Every endpoint must have all three elements, and the host exposes the endpoint. Logica
WCF Essentials (3)
8. BindingsThere are multiple aspects of communication with any given service, and there are many possible communication patterns: messages can be synchronous request/reply or asynchronous fire-and-forget; messages can be bidirectional; messages can be delivered immediately or queued; and the queues can be durable or volatile. There are many possible transport protocols for the messages, such as HTTP (or HTTPS), TCP, P2P (peer network), IPC (named pipes), or MSMQ. There are a few possible messag
WCF Essentials (2)
5. AddressesIn WCF, every service is associated with a unique address. The address provides two important elements: the location of the service and the transport protocol or transport schema used to communicate with the service. The location portion of the address indicates the name of the target machine, site, or network; a communication port, pipe, or queue; and an optional specific path or URI. A URI is a Universal Resource Identifier, and can be any unique string, such as the service name or