Wickasitha's tech Blog

blogging everything

Archive for the ‘IIS 7’ Category

A potentially dangerous Request.Path value was detected from the client (?).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A potentially dangerous Request.Path value was detected from the client (?).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): A potentially dangerous Request.
Path value was detected from the client (?).]
   System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +8884233
   System.Web.ValidateRequestExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +35
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Solution

<system.web>

        <httpRuntime requestValidationMode=”2.0″ requestPathInvalidCharacters=”" />
        <pages validateRequest=”false” />
this worked form me.

Image URL is correct but image not showing – Fixed

I have a website on my server. All permissions are set correctly and the image DOES exist. Howeverwhen the page loads the image for the item selected does not show. Here is my code

 imagepath = "~/spaimages/" + currentSpaModel.Name.ToString() + ".png";     
    if (File.Exists(Server.MapPath(imagepath))) { this.spaimage.ImageUrl = Server.MapPath(imagepath); }
spaimage is an ASP control and thr URL that the image is set to is D:\hosting\xxxxxxx
\calspas\spaimages\modelname.png 
Fixed

The file path D:\hosting\xxxxxxx\calspas\spaimages\modelname.png is the folder where theimage resides on the web server. You are sending this as the <img> tag’s src attribute, which tellsthe browser, “Go get the image at D:\hosting\xxxxxxx\calspas\spaimages\modelname.png.”The browser cannot go off to the D drive of the web server, so it looks on its own D drive for that folder and image.

What you mean to do is to have the <img> tag’s src attribute be a path to a folder on the website. You’re just about there – just drop the Server.MapPath part when assigning the image path to theImageUrl property. That is, instead of:

this.spaimage.ImageUrl = Server.MapPath(imagepath);

Do:

this.spaimage.ImageUrl = imagepath; 

it works !!!


HTTP over SSL implementation

RSS Feeds

QR Code

qr code

QR code created by QR code Widget

Fun with .NET

Visitors

Your Ads Here
Promote your products