I have an Asp.Net MVC site that uses forms authentication and does not have “public” access. Unauthorized requests are redirected to my login controller. In the view, I reference the css and js files through the Bundles. However, when deployed, requests for these packages are redirected to the login page with the RedirectUrl parameter. It makes sense?
So, how can I get specific packages for access without the need for authentication?
As a bad workaround, I know that I can just refer to individual files located in a shared folder, but this bypasses all the minimizing benefits.
Thanks.
, .
, , , . , ~/Content/styles, , , ~/Content/styles/css.
~/Content/styles
~/Content/styles/css
/css script.
/css
-, Content , , web.config
Content
<location path="Content"> <!--or whatever you call your bundle path instead of Content--> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>
.
- :
@RenderSection("scripts", required: false)
:
@section Scripts{ //put all your scripts here }
css.
, , , mvc , .
web.config
<configuration> <location path="content"> <system.web> <authorization> <allow users="?" /> </authorization> </system.web> </location> <location path="scripts"> <system.web> <authorization> <allow users="?" /> </authorization> </system.web> </location> </configuration>
Source: https://habr.com/ru/post/1528257/More articles:Функция Ajax обновляется при использовании атрибута 'fileElementId' для загрузки файла - jqueryChrome 33.0.1750.117 m, orange background icon extension - google-chromeRun "mvn dependency: tree" * in Eclipse * - javaRemove all comments from XDocument - linq-to-xmlEloquent Raw, where a query using a similar condition - eloquentswitch directive not binding ngModel - angularjsJava: calling a constructor through a constructor, what's the point? - javaPayPal REST API: Cannot set up landing page for billing - restHow to do Clickable as a link (without Javascript) - htmlHow to translate if-else to RxSwift? - reactive-programmingAll Articles