ASP Net – Image not showing in MasterPage during login


Q:I have an image in the masterpage which works fine everywhere except
the login page. I have the login control on a page (login.aspx
naturally) and the user is directed to it via forms authentication. On
that page, the image in the masterpage is replaced by the default
square. Anyone know what’s up with this?

ANS : I’ve had this problem. It seems to have happened spontaneously, but
there’s probably some mind-boggling reason I missed. In my case, Forms
Authentication began blocking access to all files, rather than allowing
images, CSS files and Javascript files.

I never figured out a real solution, and instead ended up with this
inside the ‘configuration’ tag in web.config. This unblocks all of the
specific directories to all users.

<location path=”CSS”>
<system.web>
<authorization>
<allow users=”*” />
</authorization>
</system.web>
</location>

<location path=”images”>
<system.web>
<authorization>
<allow users=”*” />
</authorization>
</system.web>
</location>

<location path=”JS”>
<system.web>
<authorization>
<allow users=”*” />
</authorization>
</system.web>
</location>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s