HI currently I am studying asp.net, how ever I manage to view my image just in my test.aspx page using this code
<img src="img/image.jpg" > but when i use it on my login.aspx using the same code no image shows up.
can anyone help me about this?
HI currently I am studying asp.net, how ever I manage to view my image just in my test.aspx page using this code
<img src="img/image.jpg" > but when i use it on my login.aspx using the same code no image shows up.
can anyone help me about this?
Short answer: when ASP.NET Forms Authentication protects your site it can also block static files (images) unless those files or their folder are explicitly allowed to anonymous users. hit this exact case.
If an image request is being intercepted by Forms Authentication the browser will get a redirect to the login page (or a 401) instead of the image. Quick checks: open the browser DevTools Network tab, reload the page, and look at the image request — if you see a 302/redirect to your login page or an HTML response where an image should be, the auth module is the culprit.
Common, practical fixes:
<configuration>
<location path="img">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
</configuration> Security note: only allow anonymous access for truly public assets. Also confirm the image path is correct (use root-relative paths to avoid folder-relative mistakes) and verify the file exists and is reachable after changing config.
ok I manage to Solve the problem. the problem was I am using a Form authentication and included my images.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.