Skip to main content

Posts

Showing posts from March, 2014

Font Awesome and MVC 4 bundle

I have a MVC 4 web project and I used FontAwesome in my code. It works perfect in development environment, but the FontAwesome icon does not show up in production environment. I used style bundling:             bundles.Add(new StyleBundle ( "~/Content/css" ).Include( "~/Content/site.css" , "~/Content/menu.css" , "~/Content/font-awesome-4.0.3/css/font-awesome.css" )); Using Fiddler tool, I can see the HTTP GET for the style bundle is: GET /Content/css?v=1fdJNYlrmyYR2zfWNxGwp9byu_Xm_F8yrFMQHaWibnk1 HTTP/1.1 As you can see, the virtual path for the bundled style is under /Content In my site, I have this following folder structure in /Content Open "font-awesome.css" file, at the beginning of the file, you can see the font-face definition:    The relative path here assume the style sheet is loaded from "/Content/font-awsome-4.0.3/css", so the "../fonts" will point to "/Content/font-awesome-4.0.3

MVC 4 Style bundle: 404 not found

When I used the kendo ui, I found the weird behavior: the site works perfect on development environment (debug mode), but the styles and image references to kendo ui are missing in production environment (release mode). After a lot of research, I found out this article and it explained every well: StyleBundle 403 Error - Solved! Basically, when you create StyleBundle, the virtual path matters. It has to  match up to the last slash before the style sheet .  The last part of the  virtual path  is essentially a throw away name. For example: I put the kendo css files in /Content/kendo folder. I have to create my StyleBundle for kendo style like: bundles.Add( new StyleBundle ( "~/Content/kendo/css" ).Include( "~/Content/kendo/kendo.common.css" , "~/Content/kendo/kendo.default.css" )); In view, I render the style bundle like:  @ Styles.Render( "~/Content/kendo/css" ) You can also define the bundle like this: bundles.Add( new  StyleBund

SAML 2.0 Assertion explained

Following is the XML piece of SAML 2.0 assertion (non-encrypted). In saml:Assertion element, the Version="2.0" identifies this is SAML 2.0 assertion. IssueInstant="2013-08-08T21:54:10.208Z" is the UTC time when this assertion is issued. saml:Issuer specifies who issues the assertion. The consumer of the assertion could validate against the value to make sure the assertion comes from the desired issuer. The entire Signature block is related to encrypt and signing of the assertion. It is automatic generated by API. saml:NameID inside saml:Subject is where you put the primary credential information of the user. It should be some information that can uniquely identify the user. saml:Conditions defines conditions to use the assertion. The most common condition is time range: NotBefore is the UTC time when this assertion becomes valid. If the consumer receives the assertion before this time, the assertion is deemed invalid. NotOnOrAfter is the UTC ti

Configuration section designer

A Visual Studio add-in that allows you to graphically design .NET Configuration Sections and automatically generates all the required code and a schema definition (XSD) for them. This is really good tool if you want to design your own complex configuration section in web.config or app.config. It saves you lots of trouble to write your own section handler. You can download the add-in here: http://csd.codeplex.com/releases Once installed, it created a new item type: It also adds this new toolbox items in the designer surface. For example, I want to create a configuration file as following: Using the configuration section designer, the design is like this: It starts with Configuration Section "SearchResultSection". You can define attributes and elements inside it. In my example, we have following elements in this section: UserLockedField UserRegisteredField UserResetField CredentialFields: this is a collection that contains CredentialField element. For