c# - Bad request exception in OData request -



c# - Bad request exception in OData request -

during execution of snippet

var res = ctx.resources.where( t => t.resourceid == "t/15") .first();

the programme throws bad request - error in query syntax exception.

the problem '/' char string.

it of import note resourceid string , "the key" of resources entity.

the special char mandatory in our system.

this error occurs since special characters /have escaped in odata request. in .net framework utilize uri.escapedatastring method purpose, example:

var encresourceid = uri.escapedatastring("t/15"); var res = ctx.resources.where( t => t.resourceid == encresourceid) .first();

it assumed specified query transformed next odata request:

http://localhost/odata/resources()?$filter=resourceid eq 't%2f15'

c# linq odata

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -