Thursday, November 22, 2012

A potentially dangerous request.querystring value was detected from the client asp.net


Last Week, while working on an ASP.NET Web project, I got an issue. The issue was, when I am trying to pass unencoded HTML content into a querystring I got an error something like ”A potentially dangerous Request. Form value was detected from the client”. After that I surf through the net and then got a solution. Here are possible solution which may help you. Put this below script in existing “page” directive in that .aspx file.

<%@ Page validateRequest="false" %>

If you are having more pages in your project means its very difficult to put this code in each page.so add this below tag in Web.Config file to access it globally

<configuration>
<system.web>
<pages validateRequest="false" />
</system.web>
</configuration>

If you are using .Net 4.0 than you have to make one more change in Web.Config file. Add this tag in section.
<httpRuntime  requestValidationMode="2.0" />

If You are facing the same problem in ASP.NET MVC 3.
Add this below code in Application_Start() method.

GlobalFilters.Filters.Add(new ValidateInputAttribute(false));

Note: When disabling the request validation on the application make sure to validate the entire application

Tuesday, November 20, 2012

Collapse Selection in Solution Explorer extension

After much feedback asking for a feature that would recursively collapse nodes in the solution explorer. Visual Studio Project Team are happy to announce the Collapse Selection in Solution Explorer extension!


What is the Collapse Selection in Solution Explorer extension?
Many Visual Studio users have a solution tree structure with multiple projects and solution folders that are organized as a deep hierarchy. To avoid visual pollution, users want only those projects expanded that are being actively developed (often with many of the project’s child nodes recursively collapsed). To accomplish this task, they have to manually collapse each node recursively – an onerous chore if one has a deeply nested solution tree. The Collapse Selection in Solution Explorer extension addresses this particular issue by enabling the user to recursively collapse multiple nodes with a single click.
How do I install the extension?
1. You can download the extension from the VS Gallery. Double-click the downloaded VSIX file and the extension will be installed.
2. You can navigate to Tools –> Extension Manager, and search for “Collapse Selection in Solution Explorer” in the Online Gallery. Simply download and click Install.
How does the extension work?
Once the extension is installed, you will see a button appear in the Solution Explorer bar. Choose any collapsible node (any node with children nodes; i.e. parent node) in the Solution Explorer and click the Collapse Selection button. All the children nodes will be recursively collapsed to show only the parent node. When you click the expand/collapse icon next to the just collapsed parent node, the parent node will expand to list all the children nodes which will appear collapsed if they have their own children nodes (see figure below). You can select the solution node and click the Collapse Selection button to recursively collapse all nodes in the solution tree. You can also select multiple collapsible nodes and click the Collapse Selection button to recursively collapse each of them.

I prefer using my keyboard. Is it possible to use this extension through keyboard shortcuts?
Definitely. Ensure that the focus is on the Solution Explorer and press Alt + Num(-) to collapse selected nodes. You can also use the Command Window by entering the following command: View.CollapseSelectionInSolutionExplorer.
Is this extension limited to certain project types?
No. This extension should work with all project types.

Source: From Here



Find a cool free stuff everyday

Giveaway of the Day

Hiren Bharadwa's Posts

DotNetJalps