|
-
September 15th, 2008, 07:21 AM
#1
showing login page's images bypassing form authentication
Hello, I am using Net framework V.2
Pl see my websites's web.config below.
my page contains some good quality images, which I want to show
im all pages(as developed as a user control) including logon.aspx page
also.
but when the home page is requested, it is redirected to the logon.aspx -
unfortunately the images not showing up in the logon.aspx - instead
image markings only appears - any way solve this problem
<system.web>
<authentication mode="Forms">
<forms loginUrl="Logon.aspx" name=".ASPXFORMSAUTH"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
VB.Net 2005, Net Framework 2.0
-
September 15th, 2008, 07:54 AM
#2
Re: showing login page's images bypassing form authentication
You need to put images to be visible before login in a public folder. A request for any other file in your project folder will redirect to the login page.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010
-
September 15th, 2008, 10:49 AM
#3
Re: showing login page's images bypassing form authentication
You can also make the images folder have its own authorization section of the web.config. Consider if you have an "/images" folder - you can add this to the web.config:
Code:
<location path="/images">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
You can have as many of these as you need - it can point to directories or specific paths as well (ie, weather.aspx, etc..)
-
September 16th, 2008, 01:08 AM
#4
Re: showing login page's images bypassing form authentication
 Originally Posted by mmetzger
You can also make the images folder have its own authorization section of the web.config. Consider if you have an "/images" folder - you can add this to the web.config:
Code:
<location path="/images">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
You can have as many of these as you need - it can point to directories or specific paths as well (ie, weather.aspx, etc..)
NOT WORKING
below is the web.config file - images contains all the images loaded to the
user control that is part of the logon.aspx page
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="connectionString" connectionString="Server=.;database=ekd;uid=sa;pwd=sa"/>
</connectionStrings>
<location path="~/images">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.web>
<authentication mode="Forms">
<forms loginUrl="Logon.aspx" name=".ASPXFORMSAUTH"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
<authentication mode="Windows"/>
-->
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
VB.Net 2005, Net Framework 2.0
-
September 16th, 2008, 01:10 AM
#5
Re: showing login page's images bypassing form authentication
 Originally Posted by HairyMonkeyMan
You need to put images to be visible before login in a public folder. A request for any other file in your project folder will redirect to the login page.
HOW pliblic folder is configured for a website
VB.Net 2005, Net Framework 2.0
-
September 16th, 2008, 09:04 AM
#6
Re: showing login page's images bypassing form authentication
Try two things:
- Put the location attributes after the forms section of the web.config
- Remove the ~/ portion from ~/Images
Refer to http://quickstarts.asp.net/QuickStar...apSecurity.src for an example.
-
September 16th, 2008, 10:08 PM
#7
Re: showing login page's images bypassing form authentication
 Originally Posted by mmetzger
- Remove the ~/ portion from ~/Images - worked,
thanks a lot
VB.Net 2005, Net Framework 2.0
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|