Share via

controller access denoyed

Samiullah Barki 1 Reputation point
2022-03-07T10:08:55.937+00:00

My C# controller method was call by postman how to stop it from calling it.

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

Developer technologies | ASP.NET Core | Other
0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2022-03-08T01:48:34.84+00:00

    Hi @Samiullah Barki ,

    Whether your application is an .NET application (asp.net core or asp.net 5,6) or a .NET Framework application (.NET Framework 1.0 - 4.8)?

    My C# controller method was call by postman how to stop it from calling it.

    To this issue, you can't prevent the API/MVC controller method called by the postman. You can reject the request based on the source IP or port, the headers including user agent, API keys or other credentials, but if your API can be accessed at all, then it can be accessed by postman or any other client using the same data.

    To limit the way how people can access the data you can add API keys and user credentials, but the same user with the same API key and credentials will be able to access your API using any other software (like postman) and there is no way around it.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    Was this answer helpful?

    1 person found this answer helpful.

  2. Bruce (SqlWork.com) 84,086 Reputation points
    2022-03-07T16:00:01.823+00:00

    Web site are an open api. There is no way to inforce the controllers to only be called by the site web pages. There are dozen of screen scraper tools to support by passing the pages.

    You should assume the controllers are called by via outside sources, verify the data and user access.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  3. AgaveJoe 31,361 Reputation points
    2022-03-07T11:41:54.33+00:00

    Use the authentication and authorization features.

    Simple authorization in ASP.NET Core

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.