I'm working on Asp Mvc 4 project that is working very good on my development system, it's also working very good on my demo hosting server. But when i upload site on client's server it ask for log in on each page. and when i log in on one page i can perform action on that page. but if it open another page it redirect me to log in page again.
I can't understand the reason. Because it works fine on my local system and also on my demo hosting. But on client hosting it behave like this.
I'm using custom Authorization Attribute. but i use this method on another site that is running very well.
any idea or solution please.
Following is me web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AccountingSystem.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="UI.Web.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=SQLSERVER4;Initial Catalog=clouddms_dms_demo;Integrated Security=False;User ID=*****;Password=******;Connect Timeout=15;Encrypt=False;Packet Size=4096" providerName="System.Data.SqlClient" />
<add name="DocumentManagerEntities" connectionString="metadata=res://*/DataContext.csdl|res://*/DataContext.ssdl|res://*/DataContext.msl;provider=System.Data.SqlClient;provider connection string="data source=SQLSERVER4;initial catalog=clouddms_dms_demo;integrated security=False;;User ID=******;Password=*****;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="microsoft.visualstudio.teamsystems.backupinfo" value="1;web.config.backup" />
<add key="microsoft.visualstudio.teamsystems.aspnetdevserver:/" value="8804;True;7480;1;-8587902403488351008" />
</appSettings>
<system.web>
<compilation targetFramework="4.0" />
<customErrors mode="Off" defaultRedirect="~/Error/" />
<!--<customErrors mode="On" defaultRedirect="~/Error/">
<error statusCode="403" redirect="~/Error/InsufcientPrivilage"/>
<error statusCode="404" redirect="~/Error/PageNotFound"/>
</customErrors>-->
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<profile inherits="UI.Web.UserProfile" defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<!--<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
</providers>
</profile>-->
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="DefaultRoleProvider">
<providers>
<add connectionStringName="DefaultConnection" applicationName="/" name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</providers>
</roleManager>
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
<add value="index.php" />
</files>
</defaultDocument>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<applicationSettings>
<UI.Web.Properties.Settings>
<setting name="DataRootDir" serializeAs="String">
<value>/Data/</value>
</setting>
<setting name="DataUserRoot" serializeAs="String">
<value>/Data/Users/</value>
</setting>
<setting name="SiteDatalDir" serializeAs="String">
<value>/Data/SiteData/</value>
</setting>
<setting name="FileIconDir" serializeAs="String">
<value>/Data/SiteData/Icons/</value>
</setting>
<setting name="ContactPicDir" serializeAs="String">
<value>/Data/SiteData/ContactPic/</value>
</setting>
</UI.Web.Properties.Settings>
<!--<UI.Web.Properties.Settings>
<setting name="DataGlobalDir" serializeAs="String">
<value>/Data/</value>
</setting>
<setting name="UserDataRootDir" serializeAs="String">
<value>/Data/Company/</value>
</setting>
<setting name="SiteDatalDir" serializeAs="String">
<value>/Data/Site/</value>
</setting>
</UI.Web.Properties.Settings>-->
</applicationSettings>
</configuration>
I tried many ways and also searched on internet but could not find solution. The main confusion was that same build worked on other servers. but on actual client's server i signed out user. So i asked my client to change hosting server. AND that works.
Now on new hosting its working great.............. thanks @Eric Wang for your ideas.