TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dharmraj Thakur
248
7.7k
708.8k
Middleware should ignore specific routes in .net core
Mar 29 2018 2:58 AM
I have a web api in asp.net core 2.0. I have functionality that every request will pass the APIKey in header and my api server will read that apikey check it and allow the request if apikey is valid. I implemented it by using middleware.
Now this middleware executing before every request of whole api server. When request is coming for registration or login, API key will not there and server should allow them request without executing middleware...
app.UseMiddleware<VerifyClientMiddleware>();
I did temporary solution which I don't want... I wrote a condition in middleware which allow login and registration api.
if
(context.Request.Path.Value.Contains(
"/user/authenticate"
) || context.Request.Path.Value.Contains(
"/user/register"
))
{
await _next.Invoke(context);
// call next middleware
}
Thanks in advance.
Reply
Answers (
9
)
How to show default image if there is no image in database i
how to open a Pdf by Clicking gridview Itemtemplate Linkbut