Solved

URL 302 issue

Posted on 2010-11-29
5
746 Views
Last Modified: 2012-05-10
Hello All

I have a site written in ASP .NET 2.0. It uses Forms Authentication. It is running on different machines, running Windows Server 2003, Vista and 7. It is being hosted on IIS 6, 7 and 7.5.

On all these configurations, I am having the same issue.

The problem I am having is this:

http://domain.com/MyVirtualDirectory/

works fine.

But,

http://domain.com/myVirtualDirectory/

does not work. If I change the casing of the virtual directory in the url, I get constant 302 redirect http codes.

Why are these urls case sensitive? How can I stop this?

Thank you all very much,

Richard Hughes
0
Comment
Question by:richard_hughes
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:crisco96
ID: 34232145
IIS isn't case sensitive and as far as I know can't be made case sensitive. Is there some custom code written in the application that does routing based off the url?

There must be some code issue, search the project for MyVirtualDirectory and see where a string comparison is done based off that (string comparisons are case sensitive).
0
 
LVL 9

Author Comment

by:richard_hughes
ID: 34232342
There are a few comparisons based upon the url, but they are all either ToLower()'d or compares with StringComparison.OrdinalIgnoreCase. Those comparisons also don't do any redirecting.

Let me post my web.config, maybe that will help:
<?xml version="1.0"?>
<configuration>
	<configSections>
		<section name="infragistics.web" type="System.Configuration.SingleTagSectionHandler,System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
					<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
				</sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections>
	<infragistics.web enableAppStyling="false" imageDirectory="/aspnet_client/Infragistics/Images/" javaScriptDirectory="/aspnet_client/Infragistics/20102CLR35/Scripts"/>
	<appSettings>
	</appSettings>
	<system.web>
		<!--  DYNAMIC DEBUG COMPILATION
			Note that any assemblies added here will also need to be present in sub-application Bin folders.
			Set compilation debug="true" to enable ASPX debugging.  Otherwise, setting this value to
			false will improve runtime performance of this application.
			Set compilation debug="true" to insert debugging symbols (.pdb information)
			into the compiled page. Because this creates a larger file that executes
			more slowly, you should set this value to true only when debugging and to
			false at all other times. For more information, refer to the documentation about
			debugging ASP.NET files.
		-->
		<compilation defaultLanguage="c#" debug="true">
			<assemblies>
				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="Infragistics35.WebUI.Shared.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
			</assemblies>
		</compilation>
		<!--  CUSTOM ERROR MESSAGES
			Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
			Add <error> tags for each of the errors you want to handle.

			"On" Always display custom (friendly) messages.
			"Off" Always display detailed ASP.NET error information.
			"RemoteOnly" Display custom (friendly) messages only to users not running
			on the local Web server. This setting is recommended for security purposes, so
			that you do not display application detail information to remote clients.
		-->
		<customErrors mode="Off"/>
		<!--  AUTHENTICATION 
			This is set up so that applications in subfolders of this application can use exactly
			the same Forms Authentication mechanism.
			This means that logging in only need happen once for access to this or the
			"sub" application and this application's login page will be used whenever an
			attempt is made to access either application.
		-->
		<authentication mode="Forms">
			<forms name="MyVirtualDirectory" loginUrl="/MyVirtualDirectory/Login.aspx" protection="All" path="/MyVirtualDirectory" timeout="30"/>
		</authentication>
		<!--  AUTHORIZATION 
			This is set up so that applications in subfolders of this application can use exactly
			the same Forms Authentication mechanism.
		-->
		<authorization>
			<deny users="?"/>
			<!-- Added for Forms Authentication -->
			<allow users="*"/>
			<!-- Allow all users -->
			<!--  <allow     users="[comma separated list of users]"
							 roles="[comma separated list of roles]"/>
				  <deny      users="[comma separated list of users]"
							 roles="[comma separated list of roles]"/>
			-->
		</authorization>
		<!--  MACHINEKEY 
			This is set up so that applications in subfolders of this application can use exactly
			the same Forms Authentication mechanism.
			These settings are really important!
		-->
		<machineKey validationKey="..." decryptionKey="..." validation="SHA1"></machineKey>
		<!--  APPLICATION-LEVEL TRACE LOGGING
			Application-level tracing enables trace log output for every page within an application. 
			Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the
			trace information will be displayed at the bottom of each page.  Otherwise, you can view the 
			application trace log by browsing the "trace.axd" page from your web application
			root. 
		-->
		<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/>
		<!--  SESSION STATE SETTINGS
			By default ASP.NET uses cookies to identify which requests belong to a particular session. 
			If cookies are not available, a session can be tracked by adding a session identifier to the URL. 
			To disable cookies, set sessionState cookieless="true".
		-->
		<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="30"/>
		<!--  GLOBALIZATION
			This section sets the globalization settings of the application. 
		-->
		<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
		<pages>
			<controls>
				<add tagPrefix="igtbl" namespace="Infragistics.WebUI.UltraWebGrid" assembly="Infragistics35.WebUI.UltraWebGrid.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="igsch" namespace="Infragistics.WebUI.WebSchedule" assembly="Infragistics35.WebUI.WebDateChooser.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="igtxt" namespace="Infragistics.WebUI.WebDataInput" assembly="Infragistics35.WebUI.WebDataInput.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="iglbar" namespace="Infragistics.WebUI.UltraWebListbar" assembly="Infragistics35.WebUI.UltraWebListbar.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="igcmbo" namespace="Infragistics.WebUI.WebCombo" assembly="Infragistics35.WebUI.WebCombo.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="igchartdata" namespace="Infragistics.UltraChart.Data" assembly="Infragistics35.WebUI.UltraWebChart.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="igchartprop" namespace="Infragistics.UltraChart.Resources.Appearance" assembly="Infragistics35.WebUI.UltraWebChart.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="igchart" namespace="Infragistics.WebUI.UltraWebChart" assembly="Infragistics35.WebUI.UltraWebChart.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="ignav" namespace="Infragistics.WebUI.UltraWebNavigator" assembly="Infragistics35.WebUI.UltraWebNavigator.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="ig_spell" namespace="Infragistics.WebUI.WebSpellChecker" assembly="Infragistics35.WebUI.WebSpellChecker.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="igtab" namespace="Infragistics.WebUI.UltraWebTab" assembly="Infragistics35.WebUI.UltraWebTab.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="ighedit" namespace="Infragistics.WebUI.WebHtmlEditor" assembly="Infragistics35.WebUI.WebHtmlEditor.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"/>
				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="ig" namespace="Infragistics.Web.UI.LayoutControls" assembly="Infragistics35.Web.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
      </controls>
		</pages>
		<httpHandlers>
			<remove verb="*" path="*.asmx"/>
			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
		</httpHandlers>
		<httpModules>
			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
		</httpModules>
	</system.web>
	<!--  ACCESS TO SPECIFIC RESOURCES
	-->
	<location path="LoginForm.aspx">
		<system.web>
			<authorization>
				<allow users="*"/>
			</authorization>
		</system.web>
	</location>
	<location path="VerifyTransfer.aspx">
		<system.web>
			<authorization>
				<allow users="*"/>
			</authorization>
		</system.web>
	</location>
	<location path="TransferComplete.aspx">
		<system.web>
			<authorization>
				<allow users="*"/>
			</authorization>
		</system.web>
	</location>
	<system.codedom>
		<compilers>
			<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
				<providerOption name="CompilerVersion" value="v3.5"/>
				<providerOption name="WarnAsError" value="false"/>
			</compiler>
		</compilers>
	</system.codedom>
	<system.webServer>
		<validation validateIntegratedModeConfiguration="false"/>
		<modules>
			<remove name="ScriptModule"/>
			<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
		</modules>
		<handlers>
			<remove name="WebServiceHandlerFactory-Integrated"/>
			<remove name="ScriptHandlerFactory"/>
			<remove name="ScriptHandlerFactoryAppServices"/>
			<remove name="ScriptResource"/>
			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
		</handlers>
	</system.webServer>
	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
			</dependentAssembly>
			<dependentAssembly>
				<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
			</dependentAssembly>
		</assemblyBinding>
	</runtime>
</configuration>

Open in new window

0
 
LVL 9

Author Comment

by:richard_hughes
ID: 34234631
It turns out it is to do with the Path attribute of the <forms> tag.

Is there anyway to make this attribute not case-sensitive, or a way to circumvent the case-sensitivity?

Thanks,

Richard Hughes
0
 
LVL 15

Accepted Solution

by:
crisco96 earned 500 total points
ID: 34237821
Looking through the forms authentication msdn page: http://msdn.microsoft.com/en-us/library/ff647070.aspx it seems that the path attribute just defines the path of the cookie that's set. What you can do is just set the path to / that way anything on the same domain has access to the cookie.
0
 
LVL 9

Author Closing Comment

by:richard_hughes
ID: 34269420
That certianly was the reason for the problem.

Thanks a lot!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question