Jack @ ASP.NET

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries for August, 2011

Page lifecycle events in asp.net – SILVER-U

You may think it is hard to remember the page life cycle events in asp.net, remember ‘SILVER-U’, they are

S: Start
I: Initialize
L: Load
V: Validate
E: Event handling
R: Render
U: Unload

Google Web Toolkit (GWT) Overview

Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. Its goal is to enable productive development of high-performance web applications without the developer having to be an expert in browser quirks, XMLHttpRequest, and JavaScript. GWT is used by many products at Google, including Google Wave and the new version of AdWords. It’s open source, completely free, and used by thousands of developers around the world.

The GWT SDK provides a set of core Java APIs and Widgets. These allow you to write AJAX applications in Java and then compile the source to highly optimized JavaScript that runs across all browsers, including mobile browsers for Android and the iPhone.

Constructing AJAX applications in this manner is more productive thanks to a higher level of abstraction on top of common concepts like DOM manipulation and XHR communication.

You aren’t limited to pre-canned widgets either. Anything you can do with the browser’s DOM and JavaScript can be done in GWT, including interacting with hand-written JavaScript.

HTML5 support in Visual Studio 2010 SP1

Visual Studio 2010 was originally released without HTML5 support, so does SP1 finally add support for it? Yes, to some extent. The entire HTML5 specification isn’t supported but most of the new elements and attributes are. That means you get both intellisense and validation for HTML5 with SP1.

Turn it on

After installing SP1 you have to tell Visual Studio to start using the HTML5 schema. Go to Tools -> Options, and then select Text Editor -> HTML -> Validation. You should now be able to select HTML5 or XHTML5 as the target schema.

clip_image002

Or if you have the HTML Source Editing toolbar enabled, you can select it in the target schema dropdown.

clip_image003

Visual Studio 2010 crash when creating a New Project

My visual studio 2010 crashed when creating a New Project. My environment is Windows 7 – 64 bit, Visual Studio 2010. And after google the solution, if got the solution

Delete or move the contents of C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache

Hope it may help the one also met this problem

SSL in IIS7

To illustrate how each of the IIS 6.0 configuration settings are carried over into the IIS 7 configuration (or HTTP.SYS configuration), the following chart has been constructed below.

IIS 6.0 Metabase configuration Description of property IIS 7.0 Architecture
AccessSSLFlags AccessSSLFlags is bitmask of
AccessSSL
AccessSSL128
AccessSSLNegotiateCert
AccessSSLRequireCert
AccessSSLMapCert0 value means no SSL.
Property still supported in IIS 7.0 configuration in the <access> section
CertCheckMode Enable or disable CRL (certificate revocation list) checking. This value will now be stored in http.sys in the PHTTP_SERVICE_CONFIG_SSL_PARAM object.
RevocationFreshnessTime If the RevocationFreshnessTime property is set to 1 (true), then the certificate revocation list (CRL) on the certificate client is updated by the CRL from the remote location, even if the CRL that is cached on the certificate client is valid. The default timeout interval is one day unless you use the RevocationURLRetrievalTimeout to specify a different timeout interval (in minutes). This value will now be stored in http.sys in the PHTTP_SERVICE_CONFIG_SSL_PARAM object.
SecureBindings The SecureBindings property specifies a string that is used by IIS to determine which secure network endpoints are used by the server instance. This property is still supported in IIS 7.0 configuration under the <binding> section for <sites>. The protocol used needs to by “https”.
SSLAlwaysNegoClientCert The SSLAlwaysNegoClientCert property controls SSL client connection negotiations. If this property is set to true, any time SSL connections are negotiated, the server will immediately negotiate a client certificate, preventing an expensive renegotiation. Setting SSLAlwaysNegoClientCert also helps eliminate client certificate renegotiation deadlocks, which may occur when a client is blocked on sending a large request body when a renegotiation request is received. This value will now be stored in http.sys in the PHTTP_SERVICE_CONFIG_SSL_PARAM object.
SSLCertHash The SSLCertHash property is used to store the hash of the SSL certificate being used. This value will now be stored in http.sys in the PHTTP_SERVICE_CONFIG_SSL_PARAM object.
SslCtlIdentifier The SslCtlIdentifier property contains a unique value that identifies a specific certificate trust list (CTL).  It must be used with SslCtlStoreName to accurately reference a CTL. This value will now be stored in http.sys in the PHTTP_SERVICE_CONFIG_SSL_PARAM object.
SslCtlStoreName The SslCtlStoreName property contains the name of the CryptoAPI store that contains certificate trust lists (CTL). It must be used with SslCtlIdentifier to accurately reference a CTL. This value will now be stored in http.sys in the PHTTP_SERVICE_CONFIG_SSL_PARAM object.
SSLStoreName The SSLStoreName property is used to store the name of the store where the key pair of the certificate resides. This value will now be stored in http.sys in the PHTTP_SERVICE_CONFIG_SSL_PARAM object.
SslUseDsMapper The SslUseDsMapper property specifies whether IIS is to use the Windows Directory Service certificate mapper or IIS certificate mapper. If SSLUseDSMapper is set to false, IIS uses the IIS certificate mapper. This value will now be stored in http.sys in the PHTTP_SERVICE_CONFIG_SSL_PARAM object.

Update the ViewModel when a Text is changed in the View (WPF-MVMV)

There are 4 types of UpdateSourceTrigger types in binding, they are

Default: The default UpdateSourceTrigger value of the binding target property. The default value for most dependency properties is PropertyChanged, while the Text property has a default value of LostFocus. A programmatic way to determine the default UpdateSourceTrigger value of a dependency property is to get the property metadata of the property using GetMetadata and then check the value of the DefaultUpdateSourceTrigger property.

PropertyChanged: Updates the binding source immediately whenever the binding target property changes.

LostFocus: Updates the binding source whenever the binding target element loses focus.

Explicit: Updates the binding source only when you call the UpdateSource method.

So, use the PropertyChanged binding type can update the VM immediate when a text is change, for example

<TextBox Text="{Binding UserAlias, UpdateSourceTrigger=PropertyChanged}" />