Middleware for custom urls–part 29
The question was how I can now intercept calls like
? There is no controller ! So – middleware to help!
For reading about middleware, please see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-3.0
For rewriting, please see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/url-rewriting?view=aspnetcore-3.0
Anyway, this is my code:
var service = app.ApplicationServices.GetService<LoadExchangeProviders>();
foreach (var item in service.Banks())
cnt.Request.Path.Value.StartsWith(“/” + item + “/”, StringComparison.InvariantCultureIgnoreCase)
cnt.Request.Path.Value.EndsWith(“.” + item, StringComparison.InvariantCultureIgnoreCase)
Figures also that previous answer was a string, not an object – changing return type to string
InfovalutarAnd one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )