Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.3 KB

ASP010.md

File metadata and controls

58 lines (43 loc) · 1.3 KB

ASP010

Unexpected character in url

Topic Value
Id ASP010
Severity Warning
Enabled True
Category AspNetCoreAnalyzers.Routing
Code AttributeAnalyzer

Description

Unexpected character in url.

Motivation

[HttpGet(""api/a?b"")]
public IActionResult GetId(string id)
{
    ...
}

Throws an exception at runtime.

How to fix violations

Fix the url template.

Configure severity

Via ruleset file.

Configure the severity per project, for more info see MSDN.

Via #pragma directive.

#pragma warning disable ASP010 // Unexpected character in url
Code violating the rule here
#pragma warning restore ASP010 // Unexpected character in url

Or put this at the top of the file to disable all instances.

#pragma warning disable ASP010 // Unexpected character in url

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("AspNetCoreAnalyzers.Routing", 
    "ASP010:Unexpected character in url", 
    Justification = "Reason...")]