Igor Kitsula - Developer

A Programmer Reference

 
  1  2  3  4  

How to remove bin and/or obj folder before the build or deploy

In one of my previous articles, I explained How to: Turn on MVC compiled views or Turning on views compilation which can be very useful to detect potential errors in views code.

However, once I’ve converted my projects to Visual Studio 2013 I star receiving error on build or deploy:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

Read more...Read more...

How to create custom user login for Azure SQL Database

When I was trying to create second Azure SQL database on the same shared SQL Server I stuck for a few minutes with a problem that Azure didn’t allow me to create new user (credentials) for this new DB. It turns out that Azure UI does not allow creating users for different databases on the same server.

However, it is logically to have separate credentials for apps per database. Fortunately, we can create users and logins with T-SQL. Here is solution.

Read more...Read more...

Why ReturnUrl from login page doesn’t work and how to fix it

Common mistake or misunderstanding why login action doesn’t have ReturnUrl value, even if there is string parameter with value in the page URL. If you think about it more, you will get it – ReturnUrl  is in the page URL but not in the action URL of the login form. The trick is to pass this parameter to the form inputs or action URL parameters be submitted with login form request. It’s very easy to do with MVC.

Read more...Read more...

How to exclude xml doc files from msbuild

Many of project assemblies has xml document files, which msbuild includes in the deployment build and copy them into bin folder. To exclude these files:

Read more...Read more...

How to deploy ASP .NET MVC 4 app to remote hosting

I’ve recently upgrade my MVC apps to MVC 4 version. How to upgrade solution to MVC 4 is pretty clear from MVC Release Notes white paper, but what’s the list of MVC 4 DLLs have to be deployed with the solution if remote hosting doesn’t have installed MVC 4 assemblies. Here is my minimum list of DLLs that should be deployed with an app (it’s even shorter than MVC 3 !):

  • Microsoft.Web.Infrastructure.dll
  • System.Web.Helpers.dll
  • System.Web.Mvc.dll
  • System.Web.Razor.dll
  • System.Web.WebPages.dll
  • System.Web.WebPages.Deployment.dll
  • System.Web.WebPages.Razor.dll
Read more...Read more...

jQuery Unobtrusive Ajax in ASP.NET MVC 3

Let’s talk today a little bit about very useful and easy to use in MVC 3 jQuery library called jQuery.Ajax.Unobtrusive. With a MVC 1 and 2 Microsoft provide library to work with AJAX requests. Already then was created Ajax helper to render form and link with unobtrusive parameters for AJAX requests. But these parameters were handled only by MicrosoftMvcAjax JavaScript library. The problem is that this library is what a lot of users doesn’t want it to use. Instead, they prefer to use jQuery – “write less, do more”. With MVC 3 situation become better. Microsoft released jQuery.Ajax.Unotrusive JavaScript library. I will show you how easy we can make AJAX form (or action link) with Ajax helper and the JavaScript library.

Read more...Read more...

Using SQL Server for ASP .NET session state on hosting service provider

Can be several reasons why to use SQL Server for session state. In my case hosting service provider does not allow me to control application pool so user losing his session state from time to time and it’s very big issue. There are a lot of articles in Internet how to setup database to store ASP.NET session state, but no one explains how to setup it on a remote SQL Server database where you have no ‘sa’ rights. The problem with a standard InstallSqlState.sql script is that it tries to create SQL server job for cleaning up database from expired sessions.

Read more...Read more...

Create command line automated build for MVC app with msbuild 4 OR Visual Studio 2010 Publish command for msbuild Command line

I always wanted to have ability build or deploy my website with one run of the .bat or .cmd file. Of course there is software for this like Cruise Control or AntHill for example. But just for one small blog or website you don’t want to spend a lot of time for installing and configuring of these heavy tools.

So I always wanted to have "Publish" function from Visual Studio as a command line. And I found it! So let me share with you my experience how to build command line automated build for MVC web app.

Read more...Read more...

SyntaxHighlighter 3.0.83 after AJAX call "Can't find brush for: BRUSH" fix

After implementing pagination on my website, I was not able to highlight the code with SyntaxHighliter plugin. After AJAX call script was throwing an error: "Can't find brush for: BRUSH". After little research I found reported bug and temporary solution...

This fix is works for me and I think it can be helpful to share with others this experience. I made this fix in plugin source code, combine shCore.js, shAutoloader.js and XRegExp.js files into one, minify and compress it with YUICompressor.

Read more...Read more...

MVC Custom Error Pages

In previous article I shown you how to use log4net to log errors and redirect to custom error page. The problem in this approach is redirection. It’s not good for SEO to make redirection to custom error page.

Read more...Read more...
  1  2  3  4