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
Ronnie Kapoor
NA
2
913
Images not authorized in MVC application?
May 8 2018 3:34 AM
I have a requirement to authorize static resources present in my application so that only logged in users can access those including images.
I have form authentication enabled in my application and i am using authorization attribute in web.config and localized web.config in folders for which i want to provide access to anonymous users.
But the images are not secured and getting accessed even when the user is not logged in. Rest of the resources such as css and js are secured.
I am using below code in global web.config
<
authentication
mode
=
"Forms"
>
<
forms
loginUrl
=
"<URL>"
timeout
=
"10"
slidingExpiration
=
"true"
/>
</
authentication
>
<
authorization
>
<
deny
users
=
"?"
/>
</
authorization
>
and in localized web.config
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
location
path
=
"Content/Custom/login.scss"
>
<
system.web
>
<
authorization
>
<
allow
users
=
"*"
/>
</
authorization
>
</
system.web
>
</
location
>
<
location
path
=
"Content/Images/CSSbundle"
>
<
system.web
>
<
authorization
>
<
allow
users
=
"*"
/>
</
authorization
>
</
system.web
>
</
location
>
<
location
path
=
"Content/images"
>
<
system.web
>
<
authorization
>
<
deny
users
=
"?"
/>
</
authorization
>
</
system.web
>
</
location
>
</
configuration
>
where am i missing something ?
Reply
Answers (
1
)
Bind JSON data to rows in a table MVC4 issue
What is render method in asp.net c# ?