3

I will deploy my project in IIS and WS 2008.

I want to know how can I allow some controllers to be visited just inside my network and block people outside to see it.

Phil3992
  • 1,059
  • 6
  • 21
  • 45
saidmohamed11
  • 275
  • 5
  • 15
  • 2
    maybe here http://stackoverflow.com/questions/473687/restrict-access-to-a-specific-controller-by-ip-address-in-asp-net-mvc-beta – lordkain Sep 16 '14 at 13:14
  • add attribute authorize.. see here http://stackoverflow.com/questions/7811617/mvc3-can-one-controller-require-windows-authentication-while-a-second-allows-an – lordkain Sep 16 '14 at 13:15
  • [Forms authentication](http://msdn.microsoft.com/en-au/library/ff398049(v=vs.100).aspx) –  Sep 16 '14 at 13:18
  • @StephenMuecke How does forms authentication fit this scenario? – DavidG Sep 16 '14 at 13:25
  • @DavidG, Its a link to a basic walkthrough on using the AuthorizeAttribute to _Restricting Access to a View_ –  Sep 16 '14 at 13:31
  • 1
    @StephenMuecke All that link says is to add the attribute, nothing more. I doubt everyone would automatically make the association. The link provided by lordkain does much more and gives a full solution. – DavidG Sep 16 '14 at 13:35
  • @DavidG you are right this link has nothing to do with my problem – saidmohamed11 Sep 16 '14 at 13:37

1 Answers1

0

Use the Request.Url property to check if the request is coming from another domain. Based on the url you can hide this.

Based on this

  1. Either you check the url in controller action method or

  2. Write Custom Authorization attribute

meetkichu
  • 131
  • 1
  • 6