I am facing an issue while trying to make a request to an ASP .NET CORE API from an Angular application using Typescript.
Upon sending the request, the API searches in an SQL database for any rows with the specified value.
The problem arises when attempting to send a request containing special characters like "C++"
or "C#"
, as it only sends:
/FindBySyntax?Syntax=C
instead of /FindBySyntax?Syntax=C#
or /File/FindBySyntax?Syntax=C++
For instance, if I try to send "Javascript", it works fine and returns rows where Syntax="Javascript"
.
I am seeking a solution to successfully send special characters like "++" and "#" in the request. Can anyone advise on how to achieve this?
selectSyntax(file: FileModel){
this.service.formData = Object.assign({}, file);
return this.http.get(this.service.BaseURL + '/File/FindBySyntax?Syntax=' + this.service.formData.Syntax)
.toPromise()
.then(res => this.service.list = res as FileModel[]);
}