在我的web應用程序中,我需要創建一個動作,使用http非安全連接可訪問哪些動作。只有https才能訪問其他所有內容。 我發現我可以使用[RequireHttps]
屬性來控制器和操作。只允許一個動作在ASP.NET mvc 4上使用非安全連接,c#
但是有沒有像[AllowHttp]
屬性?
我不想把所有控制器的動作[RequireHttps]
屬性。將[RequireHttps]
添加到控制器和[AllowHttp]
可以更簡單地採取一種可以無安全訪問的操作。當然,如果這個屬性可用
我的意思是類似我們可以使用身份驗證。 [Authorize]
給控制器,[AllowAnonymous]
對於一些動作可以在沒有驗證的情況下訪問。