-1

I have a ASp.Net WebApi and I add the DelegatingHandler for modify the requestUri.

I tried some examples without results, It is possible?

I Would like to encrypt (client) Decrypt (WebApi) part of the URL.

In the WebApi exists the controller with the route:

api/employee/getInfo/{name}/{lastname}/{date}

From my web client I do the GET to the URL: http://localhost/api/employee/getInfo/jhon/smith/010525

In the client interceptor I'm encrypt the last part of the URL, (base64 for the example) http://localhost/api/employee/getInfo/amhvbi9zbWl0aC8wMTA1MjU=

Then in the SendAsync from DelegatingHandler that I want is decrypt the last part to restore to the original URL to the webapi executes the proper webapi function.

thanks.

enter image description here

Jmartinez
  • 1
  • 2

1 Answers1

0

I did the next:

I added an additional route to my controller [Route("api/employee/getInfo/{payload}")] in the webapi

in the client interceptor change the original call http://localhost/api/employee/getInfo/jhon/smith/010525 to http://localhost/api/employee/getInfo/EncryptedInfo

finally in the DelegatingHandler

decrypt and convert to QueryString http://localhost/api/employee/getInfo?name=jhon&lastname=smith&date=010525

I don't know if it's the correct way but for the moment is working. If somebody have a better and correct solution please share.

thanks.

Jmartinez
  • 1
  • 2