Browsed by
Category: Programming

Intercept raw soap messages in code using WCF

Intercept raw soap messages in code using WCF

I faced the problem today that I needed to intercept the soap messages that are send to a webservice using WCF. To make things more complicated I needed to have them as a variable in my code and most of the stuff I found online was how to enable tracing/logging. A very good example to enable tracing is found on this website. After some extensive google’ing I came across this post. The post does an excellent job of describing how…

Read More Read More

Error: This can indicate that a key is not being regenerated correctly.

Error: This can indicate that a key is not being regenerated correctly.

Recently we had the following error occur on our Dynamics CRM installation: Current key (KeyType : CrmWRPCTokenKey) is expired. This can indicate that a key is not being regenerated correctly. Current Key : CrmKey(Id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, ScaleGroupId:00000000-0000-0000-0000-000000000000, KeyType:CrmWRPCTokenKey, Expired:True, ValidOn:02/06/2015 17:39:15, ExpiresOn:03/11/2015 17:39:15, CreatedOn:02/06/2015 17:39:15, CreatedBy:NT AUTHORITY\NETWORK SERVICE. Turns out this was due to a service not coming up correctly after a power failure. Make sure Microsoft Dynamics CRM Async (maintenance) service is up and running. Restart the non maintenance one or…

Read More Read More

Use environment variables in .NET

Use environment variables in .NET

Ever wanted to use environment variables in .NET ? Just using “%UserProfile%\path to file” won’t work as it will be added to the startup path. Use this little “trick” to use those variables: Environment.ExpandEnvironmentVariables(“%UserProfile%\Desktop\myfile.txt”);

Enable web deploy on IIS 8 running on 2012 R2

Enable web deploy on IIS 8 running on 2012 R2

Web deploy enables a developer (or anyone with sufficient privileges) to build and deploy a website using visual studio or via the command line using MSBuild. An example of such a build command can be found in my previous posts. We use it mainly in our continuous integration environment to automatically build, test and deploy new code if a new commit to the git master branch was detected. Installation via web platform installer First you will need administrator rights to…

Read More Read More

How to deploy a web site project using msbuild

How to deploy a web site project using msbuild

A website project differs a bit from a normal web application. The main thing is that it doesn’t require compilation, so how do I deploy this then? A “normal” msbuild deploy will look like this: cd C:\Windows\Microsoft.NET\Framework\v4.0.30319 MSBuild “C:\STAGING\website\\.sln” /p:DeployOnBuild=true /p:PublishProfile=ToProduction /p:WebPublishTargetsVersion=11.0 /p:username= /p:password= If you try to use this on a web site project (provided you created a solution file for it), you will get following error: The precompilation target directory cannot be in the same tree as the…

Read More Read More

CkEditor paragraphs and brakes

CkEditor paragraphs and brakes

We use CkEditor here at work as our default wysiwyg editor. To overcome 2 annoying things (in my opinion) you can use the following tricks. $(function() { CKEDITOR.config.autoParagraph = false; CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR; CKEDITOR.config.shiftEnterMode = CKEDITOR.ENTER_BR; }); This piece of code will: Prevent the adding of a P tag around the whole text Render carriage return as a brake instead of a P tag

Mark validation errors

Mark validation errors

I faced a problem today that I needed to give controls, that failed validation, an error class. I found this little gem online: function WebForm_OnSubmit() {var errorControls = new Array();if (typeof (ValidatorOnSubmit) == “function” && ValidatorOnSubmit() == false) {for (var i in Page_Validators) {try {var control = document.getElementById(Page_Validators[i].controltovalidate);if (!Page_Validators[i].isvalid) {errorControls[errorControls.length] = control;}control.className = “”;} catch (e) { }}for (var i in errorControls) {errorControls[i].className = “errorClass”;}return false;}return true;} Where “errorClass” is the class you want to give your controls. Thank you…

Read More Read More