On WIF 3.5, the token is sent in XML-like format, contains tags. The error is caused by request validation in ASP.NET feature to reject request with any tag. This feature prevents cross-site scripting attack (XSS).
To workaround this issue, add the following config in your ASP.NET application’s web.config:
<httpRuntime requestValidationMode="2.0" />
This tells the ASP.NET to only perform request validation on .aspx pages – (2.0 represents ASP.NET 2.0). The request validation will not apply to all other pages / routings, so if you are on ASP.NET MVC (2, 3 or 4), disabling this open your application to the cross-site scripting attack.
To properly handle the exception error, create a class to validate the request.
This is what I have on my ASP.NET MVC 4.0
<httpRuntime requestValidationType="WsFederationRequestValidator" />
Request validator class
public class WsFederationRequestValidator : RequestValidator
protected override bool IsValidRequestString(HttpContext context, string value, RequestValidationSource requestValidationSource, string collectionKey, out int validationFailureIndex)
validationFailureIndex = 0;
if (requestValidationSource == RequestValidationSource.Form && !String.IsNullOrEmpty(collectionKey) && collectionKey.Equals(WSFederationConstants.Parameters.Result, StringComparison.Ordinal))
var _unvalidatedFormValues = System.Web.Helpers.Validation.Unvalidated(context.Request).Form;
SignInResponseMessage _message = WSFederationMessage.CreateFromNameValueCollection(WSFederationMessage.GetBaseUrl(context.Request.Url), _unvalidatedFormValues) as SignInResponseMessage;
if (_message != null)
return base.IsValidRequestString(context, value, requestValidationSource, collectionKey, out validationFailureIndex);
To enable migrations in your Entity Framework Code First project, the following commands guide you thru installation, enabling the migration, adding a migration and updating the database. All the commands are run on Package Manager Console.
Install EntityFramework package
PM> install-package EntityFramework
Enable Code First Migrations
Add a migration
PM> Add-Migration <migration_name>
Update the database
Could not load assembly ‘CFMigrationsSyntax.DataLayer’. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)
Depend on your solution and projects setup in Visual Studio, sometime Entity Framework Code First commands don’t run as expected.
By default, when Code First migration commands run, it will pick the default project set on your Package Manager Console:
But most of the time, we have separate projects in Visual Studio solutions for presentation, business and data layers. EF Code First migration is enabled on the project where your EF Context lives, data layer, while the startup project for the solution is the presentation layer’s project. And since the startup project doesn’t have reference to data layer (where EF is), Package Manager Console will always throw error when running Code First migration commands.
Here’s my typical projects setup:
MainConsole is the presentation and reference to the business layer,
CFMigrationsSyntax.BusinessLayer project. In turn,
CFMigrationsSyntax.BusinessLayer reference to the data layer,
To run EF Code First commands againts the data layer project,
CFMigrationsSyntax.DataLayer, first change the default project in Package Manager Console to your EF project and then add the following parameter to the Code First migration commands:
In my case:
PM> Enable-Migrations -StartUpProjectName CFMigrationsSyntax.DataLayer
Most of note-taking apps are bound to a basic format. It’s as if you are writing on a paper notepad. If you need a box while taking your note, you will have to draw it.
The idea is to create a note-taking app that allows customization templates. Think about playing bingo, the app loads bingo template and user fills this up. Once done, the data is saved. Often time, note-taking in an event or a conference is very specific to a format.
An organization can also create templates for forms, such as employment application form or volunteer sign up application, to collect information.
Further development can include storing all templates in cloud that users can download to their device.
- Custom template for all use.
- Everybody can create their own template.
- Paperless forms.
- Better handling of data: normalization and data integrity.
In technical detail, the templates are built with standard HTML5 & CSS3. The app will load any template and save the data just like how any form on the Internet save the form data.
Will it work?
The encryption takes place when the message is about to send over, at transport layer.
Depends on the transport protocol, normally require HTTPS (if send over HTTP).
The encryption takes place on the message itself, before it is sent.
For most part, it’s transport-independent.
More flexibility, you can use any type of security credential as long as client and service agree.
Options the security mode are:
More info on: What the difference between transport and message security?