A potentially dangerous Request.Path value was detected from the client (&) mvc5 - c#

i want to delete a image when tag a clicked, but i get this error
i have already used ValidateInput(false) but its not working
this is a view
this is error
Server Error in '/' Application.
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() +11815921
System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +54
this is controller:
[ValidateInput(false)]
public ActionResult DeleteImageCauses(int ID, int img)
{
return RedirectToAction("EditCauses", ID);
}
i have already used ValidateInput(false) but its not working

Related

Request timed out error exporting to excel in Nop Commerce?

When I attempt to export more then 5000 products to an excel file, I get this error.
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: Request timed out

Unhandled exception in ASP web.config connectionString setting

I am running an ASP website and connect to a SQL database, very standard setup. The connection string details are held in the <connectionStrings> tag of the web.config file.
If the database username/password details are not correct, I get an YSOD unhandled exception notice. This is not at all surprising, but I would like to show a custom error page instead. However, I cannot seem to get the custom page to show using <customErrors> settings.
It seems an unhandled exception at the web.config level (for example the incorrect database connection string) means the application does not get as far as redirecting to the custom error page.
Any advice on how to handle this exception would be much appreciated. I understand if the exception happened on a particular page I can add a try/catch to catch it. I am not sure where/how I can handle this exception:
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.Data.SqlClient.SqlException: Login failed for user xxxxx
Find place where this connection string is used and handle exception there.

Sequence contains no elements server side

I am developing a Asp.net MVC web application and have been deploying to a web server for a few months now. Just recently I have experienced a new error that confused me. Upon publishing my application, and loading up the website, I get the following error message:
Sequence contains no elements
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.InvalidOperationException: Sequence contains no elements
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:
[InvalidOperationException: Sequence contains no elements]
System.Linq.Enumerable.First(IEnumerable`1 source) +514
System.Linq.Queryable.First(IQueryable`1 source) +330
LabSys.MvcApplication.Application_AuthorizeRequest(Object sender, EventArgs e) +1261
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&completedSynchronously) +165
I am very confused, because the application runs perfectly on localhost, without any issue or error message. I also checked my database, and it is also connected and validated to the server. So there should be no error.
Thanks for any help in advance!
Check in your code to make sure FirstOrDefault() or SingleOrDefault() is used instead of using any of these: First() or Single().
When you get theLINQ Error "Sequence contains no elements", this is
usually because you are using the First() or Single() command rather
than FirstOrDefault() and SingleOrDefault().
Sequence contains no elements?

`Server Error in '/' Application. No such host is known

I am getting this error on one website which is deployed in IIS , when i browse from network system i am getting this error .
other websites are working fine
`Server Error in '/' Application.
No such host is known
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.Net.Sockets.SocketException: No such host is known
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:
[SocketException (0x2af9): No such host is known]
System.Net.Dns.InternalGetHostByAddress(IPAddress address, Boolean includeIPv6) +3192148
System.Net.Dns.GetHostEntry(String hostNameOrAddress) +8777246
_Default.Page_Load(Object sender, EventArgs e) +320
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178`enter code here`
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055'`
What you have here is one unhanded exception when you call the Dns.GetHostEntry as seen on the stack trace, and on the clear message that you have.
Wrap this part of the code with try/catch and log the error on your system. If its critical for you to know the dns name, then you need to show an error page with further instructions.

The remote server returned an error: (404) Not Found. when using facebook graph api

i'm developing an asp.net application. It's giving error. Any suggestions?
here is a portion of code behind:
// Authenticated, created session and API object
_connectSession = new ConnectSession(ApplicationKey, SecretKey);
if (!_connectSession.IsConnected())
{
// Not authenticated, proceed as usual.
}
else
{
// Authenticated, create API instance
_facebookAPI = new Api(_connectSession);
// Load user
user user = _facebookAPI.Users.GetInfo();
Here are details of the error:
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.Net.Sockets.SocketException: A socket operation was attempted to an unreachable host 69.63.176.141:80
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.
thanks,
Gurbax Singh
Basically what the error is telling you is that the API couldn't connect to the Facebook API server at the specified IP address.
That IP for the Facebook API doesn't seem to be in use. Make sure you are using the latest versions of any Facebook API and that you look up the API server by hostname api.facebook.com
Currently I have it resolving to 69.63.181.46
More information available # http://forum.developers.facebook.net/viewtopic.php?id=50797

Categories