WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for ‘jquery’. Please add a ScriptResourceMapping named jquery (case-sensitive)

Specifies how ASP.NET globally enables the built-in validator controls to use unobtrusive JavaScript for client-side validation logic.

Type: UnobtrusiveValidationMode

Default value: None

Remarks: If this key value is set to “None” [default], the ASP.NET application will use the pre-4.5 behavior (JavaScript inline in the pages) for client-side validation logic. If this key value is set to“WebForms”, ASP.NET uses HTML5 data-attributes and late bound JavaScript from an added script reference for client-side validation logic.

 <appSettings>
     <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
 </appSettings>

How to use Read the Docs over Windows

In order to configure and use Read the Docs in Windows environment you need to follow these steps:

Install Python

Go to http://python.org/ and download version 2.7.x

Follow the Windows installer for Python.

01

02

Please select “Add python.exe to Path”.

Complete the installation.

Pay Attention:

Now run the Command Prompt (with Admin privileges). After command prompt window appear, type python and Enter.

If the Python installation was successful, the installed Python version is printed, and you are greeted by the prompt >>>.

Type Ctrl+Z and Enter to quit.

======================

Otherwise, if python command was not found you must insert manually these lines in the Environment Variables Path:

  1. Right click on Computer > Click on Properties
  2. Click on Advanced system settings on the left (see picture below)Environment
  3. Click on “Environment Variables”
  4. Environment2
  5. Select the Path System Variables and add these two lines in the path C:\Python27\;C:\Python27\Scripts;

Install the pip command

To install pip, download https://bootstrap.pypa.io/get-pip.py and save it somewhere. After download, invoke the command prompt, go to the directory with get-pip.py and run this command:

C:\> python “<folder_path>\get-pip.py”

Now pip command is installed. From there we can go to the Sphinx install.

Installing Sphinx with pip

If you finished the installation of pip, type this line in the command prompt:

C:\> pip install sphinx

After installation, type sphinx-build on the command prompt. If everything worked fine, you will get a Sphinx version number and a list of options for this command.

Defining a new project documentation

The root directory of a Sphinx collection of reStructuredText document sources is called the source directory. This directory also contains the Sphinx configuration file conf.py, where you can configure all aspects of how Sphinx reads your sources and builds your documentation.

C:\> sphinx-quickstart

and answer its questions. (Be sure to say yes to the “autodoc” extension.)

Question #1:

> Root path for the documentation [.]: <Enter>

Question #2:

You have two options for placing the build directory for Sphinx output. Either, you use a directory “_build” within the root path, or you separate
“source” and “build” directories within the root path.
> Separate source and build directories (y/n) [n]: y

Question #3:

Inside the root directory, two more directories will be created; “_templates” for custom HTML templates and “_static” for custom stylesheets and other static files. You can enter another prefix (such as “.”) to replace the underscore.
> Name prefix for templates and static dir [_]: <Enter>

Question #4:

The project name will occur in several places in the built documentation.
> Project name: <project_name>

> Author name: <author_name>

Question #5:

Sphinx has the notion of a “version” and a “release” for the software. Each version can have multiple releases. For example, for Python the version is something like 2.5 or 3.0, while the release is something like 2.5.1 or 3.0a1.  If you don’t need this dual structure, just set both to the same value.
> Project version: 1.0

> Project release [1.0]: <Enter>

Question #6:

The file name suffix for source files. Commonly, this is either “.txt” or “.rst”.  Only files with this suffix are considered documents.
> Source file suffix [.rst]: <Enter>

Question #7:

One document is special in that it is considered the top node of the “contents tree”, that is, it is the root of the hierarchical structure of the documents. Normally, this is “index”, but if your “index” document is a custom template, you can also set this to another filename.
> Name of your master document (without suffix) [index]: <Enter>

Question #8:

Sphinx can also add configuration for epub output:
> Do you want to use the epub builder (y/n) [n]: y

Question #9:

Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/n) [n]: y

> doctest: automatically test code snippets in doctest blocks (y/n) [n]: y

> intersphinx: link between Sphinx documentation of different projects (y/n) [n]: y

> todo: write “todo” entries that can be shown or hidden on build (y/n) [n]: y

> coverage: checks for documentation coverage (y/n) [n]: y

> pngmath: include math, rendered as PNG images (y/n) [n]: y

> mathjax: include math, rendered in the browser by MathJax (y/n) [n]: y

> ifconfig: conditional inclusion of content based on config values (y/n) [n]: y

> viewcode: include links to the source code of documented Python objects (y/n) [n]: y

A Makefile and a Windows command file can be generated for you so that you only have to run e.g. `make html’ instead of invoking sphinx-build directly.
> Create Makefile? (y/n) [y]: y

> Create Windows command file? (y/n) [y]: y

Creating file .\source\conf.py.
Creating file .\source\index.rst.
Creating file .\Makefile.
Creating file .\make.bat.

Finished: An initial directory structure has been created.

You should now populate your master file .\source\index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
make builder
where “builder” is one of the supported builders, e.g. html, latex or linkcheck.

And now … Start the Docs 😉

Windows Phone Emulator wasn’t able to connect to the Windows Phone operating system

I encountered some problems while trying to start a Windows Phone Emulator from within Visual Studio 2012. In a WP8 project, after starting a debugging session, during the emulator loading, one of the following errors raised:

The Windows Phone Emulator wasn’t able to connect to the Windows Phone operating system:
The emulator couldn’t determine the host IP address, which is used to communicate with the guest virtual machine.
Some functionality may be disabled.

The Windows Phone Emulator wasn’t able to create the virtual machine: Something happened while creating a switch: Xde couldn’t find an IPv4 address for the host machine.

The WP8 app did not start, all I could see was the main tiled page of the emulated phone. Additionally, Visual Studio reported an error: “Invalid pointer“.

In order to solve this issue, follow this check list:

  1. Does your hardware support virtualization? Have you enabled it in BIOS?
  2. Are you running Windows 8 64-bit (x64) client version? It needs to be 64bit.
  3. Do you have any kind of other networking/virtualization software installed (VirtualBox, VPN software)? If you do, you might have to remove it to get the emulator work.
  4. Have you tried clearing the existing switches from Hyper-V manager and creating a new one? (run XdeCleanup.exe, is located in C:Program Files (x86)/Microsoft XDE/8.0)

Enjoy your work!

Manage Session in Asp.Net application

This post illustrate the 3 main steps to manage session in Web Forms application. This is not the only one way to do this, but it’s easy and responsive to a better user experience.

Step 1

In the Global.asax.cs in the Session_Start event add this code:

// Code that runs when a new session is started
if (Context.Session != null)
{
    if (Context.Session.IsNewSession)//|| Context.Session.Count==0)
    {
        string sCookieHeader = Request.Headers["Cookie"];
        if ((null != sCookieHeader) && (sCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
        {
           //if (Request.IsAuthenticated)
           FormsAuthentication.SignOut();
           Response.Redirect(Utility.Costants.PAGES_SESSIONEXPIRED);
        }
    }
}

and also in the Session_End event

Session.Clear();

Step 2

Add this in the web.config

<sessionState
        mode="InProc"
        timeout="30">
      <providers>
        <clear/>
      </providers>
    </sessionState>

Step 3

Create a custom Logout page and add this snippet on the Page_Load

if (User.Identity.IsAuthenticated)
{
    Session.Clear();
    Session.Abandon();
    Request.Cookies.Clear();
    FormsAuthentication.SignOut();
}

Enjoy!