Compressing static files not working on MVC and IIS - asp.net-mvc

I'm trying to enable compression on my ASP.NET MVC 5 application that is hosted on IIS 7.5 and I can't make it work.
I have both static and dynamic compression enabled on the website.
I have tried adding the following to my web.config file:
<staticContent>
<remove fileExtension=".js" />
<mimeMap fileExtension=".js" mimeType="text/javascript" />
</staticContent>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" />
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="text/javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />

Related

Redirect https secondary domain web-config

I have one Secondary domain in my host
I want to read https : //Mydoaminname.com
but after add this code For redirect here is my problems address bar :
https : //Mydoaminname.com/Mydoaminname/
<configuration>
<system.web>
<httpRuntime enableVersionHeader="false" targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5"/>
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files\(compressionType)\(AppPool)\(WebSite)\compressed files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" />
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true"/>
</system.webServer>
</configuration>
This rewrite code its work great for primary domain but for secondary its make address bar problems
<rules>
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>

HTTP Error 500.19 - Internal Server Error in IIS 10

I change my server of website .The new server has windows 10 2016 R2 OS and use IIS 10.
I transfer files from old server to new server and add website and then binding port 80 to this website. Now when browse website get this error :
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.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="TravelEnterProject.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=.;Initial Catalog=TravelEnterDB;User ID=User;Password=rLyVhrghj#A39Ac" providerName="System.Data.SqlClient" />
<add name="TravelEnterDBEntities" connectionString="metadata=res://*/AdakDbModel.csdl|res://*/AdakDbModel.ssdl|res://*/AdakDbModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=TravelEnterDB;persist security info=True;user id=User;password=rLyVhrdfffd#j#A39Ac;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="TravelEnterDBEntities2" connectionString="metadata=res://*/Models.DbModel.TravelEnterModels.csdl|res://*/Models.DbModel.TravelEnterModels.ssdl|res://*/Models.DbModel.TravelEnterModels.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=TravelEnterDB;user id=User;password=rLyVhr9dfdf39Ac;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="fullsize" value="/uploadimage/UploadImages/" />
<add key="Image900x500" value="/uploadimage/UploadImages/900x500/" />
<add key="Image270x160" value="/uploadimage/UploadImages/270x160/" />
<add key="Image70x70" value="/uploadimage/UploadImages/70x70/" />
<add key="Sitekey" value="6LfbRCwUAAAAANSNLUZvBUMmn6Nzc-q" />
<add key="Secretkey" value="6LfbRCwUAAAAAKDeRsyy7vcupQME1wO" />
</appSettings>
<system.web>
<authentication mode="None" />
<compilation debug="false" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<httpCookies requireSSL="true" />
<customErrors mode="on" />
</system.web>
<system.webServer>
<stripHeaders>
<header name="Server" />
<header name="X-Powered-By" />
<header name="X-Aspnet-Version" />
</stripHeaders>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<add name="X-Frame-Options" value="SAMEORIGIN" />
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<validation validateIntegratedModeConfiguration="false" />
<modules>
</modules>
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
<rule name="charter" enabled="false">
<match url="^charter/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/(.*)" />
<action type="Rewrite" url="Charter?depCountryId={R:1}&DepCityId={R:2}&ArrCountryId={R:3}&ArrCityId={R:4}&Fromdate={R:5}&DateRange={R:6}&ADT={R:7}&CHD={R:8}&INF={R:9}&S={R:10}" />
</rule>
<rule name="Redirect non-www to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="travelenter.com" />
</conditions>
<action type="Redirect" url="https://www.travelenter.com/{R:0}" />
</rule>
</rules>
<outboundRules>
<rule name="changeServerHeader">
<match serverVariable="RESPONSE_Server" pattern=".*" />
<action type="Rewrite" value="heloooo" />
</rule>
</outboundRules>
</rewrite>
<security>
<requestFiltering>
<verbs>
<add verb="TRACE" allowed="false" />
<add verb="HEAD" allowed="false" />
<add verb="OPTIONS" allowed="false" />
</verbs>
</requestFiltering>
</security>
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Rewrite" verbosity="Verbose" />
</traceAreas>
<failureDefinitions timeTaken="00:00:00" statusCodes="500" verbosity="Ignore" />
</add>
</traceFailedRequests>
</tracing>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMaxAge="96:00:00" cacheControlMode="UseMaxAge" />
</staticContent>
<caching>
<profiles>
<add extension=".woff" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".ico" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="00:00:30" />
<add extension=".css" policy="DisableCache" kernelCachePolicy="DontCache" duration="24.00:00:00" />
<add extension=".js" policy="DisableCache" kernelCachePolicy="DontCache" duration="24.00:00:00" />
<add extension=".ttf" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="24.00:00:00" />
<add extension=".png" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="24.00:00:00" />
<add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="24.00:00:00" />
</profiles>
</caching>
<httpErrors errorMode="Detailed" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" path="https://www.ttttttt.com/404.htm" responseMode="Redirect" />
</httpErrors>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_IFlightService">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
<basicHttpBinding>
<binding name="BindingCharter" maxReceivedMessageSize="999999999" maxBufferSize="999999999" maxBufferPoolSize="999999999" sendTimeout="00:55:00" receiveTimeout="00:09:00" openTimeout="00:10:00" closeTimeout="00:10:00" />
</basicHttpBinding>
</bindings>
<client>
<endpoint name="BasicHttpBinding_ICharterService" address="http://localhost:8080/CharterWs/CharterService.svc" binding="basicHttpBinding" bindingConfiguration="BindingCharter" contract="CharterMiddleWebService.ICharterService" />
<endpoint name="CustomBinding_IFlightService" address="http://82.50.209.208:8080/FlightMiddleService/FlightService.svc" binding="customBinding" bindingConfiguration="CustomBinding_IFlightService" contract="flightReference.IFlightService" />
</client>
</system.serviceModel>
<applicationSettings>
<TravelEnterProject.Properties.Settings>
<setting name="TravelEnterProject_AdakFlightRefrence_AdakFlight" serializeAs="String">
<value>http://localhost:8080/FlightWS/AdakFlight.svc</value>
</setting>
<setting name="TravelEnterProject_RajaReference_online2Services" serializeAs="String">
<value>https://webservices.raja.ir/online2Services.asmx</value>
</setting>
<setting name="TravelEnterProject_CharterFlightsReference_Service1" serializeAs="String">
<value>http://localhost:8080/CharterFlights/Flights.svc</value>
</setting>
<setting name="TravelEnterProject_AutoRentService_AutoRentService" serializeAs="String">
<value>http://service.karanehnovin.ir/AutoRentService.asmx</value>
</setting>
<setting name="AdakCharterLib_CharterMiddleWebService_CharterService" serializeAs="String">
<value>http://localhost:8080/CharterWs/CharterService.svc</value>
</setting>
<setting name="AdakTrainLib_AdakTrainWebReference_TrainService" serializeAs="String">
<value>http://127.0.0.1:8085/TrainService.svc</value>
</setting>
</TravelEnterProject.Properties.Settings>
</applicationSettings>
</configuration>
compilation section in machine.config :
<section name="compilation" type="System.Web.Configuration.CompilationSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" requirePermission="false"/>
my web.config file has no this section .
Where should I place this? And is there any other problem?
After some troubleshooting it was found that url rewrite module was missing.
Url rewrite module can be downloaded and installed from
https://www.microsoft.com/en-us/download/details.aspx?id=47337

ASP .NET application keep prompting credential

I have an ASP .NET application. I am trying to log in but it keeps asking for login even though my credential is correct and have sufficient privileges to access to the required database. I tried all solutions which I look around on the internet include changing Visual Studio project property, move NTML of Window Authentication to top, disabled Anonymous Authentication, added IIS_IUSRS, Authenticated Users, IIS user, my credential to Folder Permission. This application was not well documented, from my boss, he believes this app use Windows Authentication due to internal usage purpose. It has two parts, the first part is the app and the second is the engine. The first part app Windows Authentication is fine. I put the engine part under the same folder where the app is located in IIS. The engine is built on my dev local computer then copy to the server. My purpose to learn what the code does. I am trying to spin up the second part, is the engine, however, it seems odd to me though. I got 401.1 - Unauthorized: Access is denied due to invalid credentials if I hit Esc or Cancel the login prompt. Appreciate any help or suggestion.
FYI: The app and engine are applications stay under the website.
Website > App + Engine
IIS 7.5, Windows Server 2008 R2, VS2015, maybe ASP .NET MVC (not sure)
Here is my Web.config file for the engine
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="SecurityDatabase" connectionString="Data Source=TEX_ITY;Initial Catalog=TEx;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<!-- ASP.NET CONFIG -->
<add key="webpages:Version" value="3.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="aspnet:MaxHttpCollectionKeys" value="50000" />
<!-- TEx -->
<!-- SERVICES CONFIG -->
<add key="EmailServiceUrlFormat" value="https://{0}/Services/Email/TExEmailService.svc" />
<add key="DataExecutionServiceUrlFormat" value="https://{0}/Services/DataExecution/TExDataExecutionService.svc" />
<add key="AccountProcessingServiceUrlFormat" value="https://{0}/Services/AccountProcessing/TExAccountProcessingService.svc" />
<add key="ElectronicFileTransmissionServiceUrlFormat" value="https://{0}/Services/Filing/TExElectronicFileTransmissionService.svc" />
<!-- LOGGING CONFIG -->
<add key="MasterLogLevel" value="Trace" />
<add key="MaxStoredLogCount" value="1000" />
<!-- IMPORT CONFIG -->
<add key="ImportFileEEThreshold" value="50000" />
<add key="ImportLogsStatistics" value="true" />
<add key="ThemeName" value="Forest" />
<add key="RoutesXmlFilePath" value="~/App_Data/Routes.xml" />
<add key="RotatedTextBaseUrl" value="~/TextAsImage.axd" />
<add key="FileDownloadBaseUrl" value="~/FileDownload.axd" />
<add key="CompanyImportSchema" value="~/App_Data/Schemas/CompanyImport.xsd" />
<add key="CompanyImportSchema2" value="~/App_Data/Schemas/New Schema/CompanyImport.xsd" />
<add key="TabDelimitedCompanySetupSchema" value="~/App_Data/Schemas/TabDelimitedCompanySetup.xsd" />
<add key="TabDelimitedTaxSetupSchema" value="~/App_Data/Schemas/TabDelimitedTaxSetup.xsd" />
<add key="TabDelimitedTaxDetailSchema" value="~/App_Data/Schemas/TabDelimitedTaxDetail.xsd" />
<add key="TabDelimitedCompanySetupSampleXml" value="~/App_Data/SampleXmls/CompanySetupSampleFile.xlsx" />
<add key="TabDelimitedTaxSetupSampleXml" value="~/App_Data/SampleXmls/TaxSetupSampleFile.xlsx" />
<add key="TabDelimitedTaxDetailSampleXml" value="~/App_Data/SampleXmls/TaxDetailSampleFile.xlsx" />
<add key="TransformGenerateUnMergedTaxDetails" value="~/App_Data/Transforms/GenerateUnMergedTaxDetails.xslt" />
<add key="TransformGenerateMergedTaxDetails" value="~/App_Data/Transforms/GenerateMergedTaxDetails.xslt" />
<add key="TransformGenerateMergedTaxDetailsWithXmlns" value="~/App_Data/Transforms/GenerateMergedTaxDetailsWithXmlns.xslt" />
<add key="CompanyImportSchemav1.00" value="~/App_Data/Schemas/CompanyImportv1.00.xsd" />
<add key="CompanyImportTransformv1.00to1.01" value="~/App_Data/Schemas/CompanyImportv1.00to1.01.xslt" />
<add key="CryaReportSummaryReportSchema" value="~/App_Data/Schemas/SummaryReport.xsd" />
<add key="TExCoverLetterDefaultTemplate" value="~/App_Data/TExCoverSheet.docx" />
<add key="TransformerDirPath" value="~/Uploads/TEx-Engine/Release/Transformers" />
<add key="ReportElectronicFilingSpecDirPath" value="~/Uploads/TEx-Engine/Reports/Electronic/Specs" />
<add key="ReportPaperFilingAgencyReportDirPath" value="~/Uploads/TEx-Engine/Reports/Paper/AgencyReport" />
<add key="ReportPaperFilingCustomReportDirPath" value="~/Uploads/TEx-Engine/Release/CustomReport" />
<add key="ReportPaperFilingSpecDirPath" value="~/Uploads/TEx-Engine/Reports/Paper/Specs" />
</appSettings>
<location path="." inheritInChildApplications="false">
<system.web>
<pages controlRenderingCompatibilityVersion="4.0" enableViewState="false">
<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.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="Crya.Core.Extensions" />
<add namespace="Crya.Core.Linq.Expressions" />
<add namespace="Crya.Core.Utils" />
<add namespace="Crya.Core.Web.Data" />
<add namespace="Crya.Core.Web.Extensions" />
<add namespace="Crya.Core.Web.Mvc.Assets" />
<add namespace="Crya.Core.Web.Mvc.Assets.Extensions" />
<add namespace="Crya.Core.Web.Mvc.Extensions" />
<add namespace="Crya.Core.Web.Mvc.Utils" />
<add namespace="Crya.Core.Web.Mvc.Utils.Builders" />
<add namespace="TEx.Ui.Web.Extensions" />
<add namespace="TEx.Ui.Web.Models.Data" />
<add namespace="TEx.Ui.Web.Models.Data.Controls" />
<add namespace="TEx.Ui.Web.Models.Data.Domain" />
<add namespace="TEx.Ui.Web.Utils" />
<add namespace="TEx.Ui.Web.Utils.Builders" />
<add namespace="Telerik.Web.Mvc.Extensions" />
</namespaces>
<controls>
<add tagPrefix="te" assembly="TEx.Ui.Web" namespace="TEx.Ui.Web.Models" />
</controls>
</pages>
<httpHandlers>
<add verb="GET" path="TextAsImage.axd" type="Crya.Core.Web.Imaging.RotatedTextGenerator" validate="false" />
<add verb="GET" path="FileDownload.axd" type="Crya.Core.Web.Content.DownloadFileHandler" validate="false" />
<add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
<httpModules>
<add name="TExAuthentication" type="TEx.Shared.Security.TExAuthenticationModule, TEx.Shared" />
</httpModules>
<siteMap defaultProvider="CombinedSiteMapProvider">
<providers>
<add name="CombinedSiteMapProvider" type="TEx.Ui.Web.Navigation.SiteMap.TExSiteMapProvider" siteMapFile="~/Web.sitemap" areaName="" forceLowerCaseUrl="true" forceTrailingSlashUrl="true" />
<add name="EngineSiteMapProvider" type="TEx.Ui.Web.Navigation.SiteMap.TExSiteMapProvider" siteMapFile="~/Areas/Engine/Web.sitemap" areaName="Engine" forceLowerCaseUrl="true" forceTrailingSlashUrl="true" />
</providers>
</siteMap>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="TExAuthentication" type="TEx.Shared.Security.TExAuthenticationModule, TEx.Shared" />
</modules>
<handlers>
<add name="rotatedText" verb="GET" path="TextAsImage.axd" type="Crya.Core.Web.Imaging.RotatedTextGenerator" />
<add name="downloadFile" verb="GET" path="FileDownload.axd" type="Crya.Core.Web.Content.DownloadFileHandler" />
<remove name="asset" />
<add name="asset" preCondition="integratedMode" verb="GET,HEAD" path="asset.axd" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
<add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>
<rewrite>
<rules>
<rule name="HTTP to HTTPS" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{HTTPS}" pattern="off" />
<add input="{HTTP_HOST}" pattern="([^/:]+)(:[^/]*)?" />
</conditions>
<action type="Redirect" url="https://{C:1}/{R:0}" appendQueryString="true" />
</rule>
<rule name="Lower Case URLs" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{URL}" pattern="WebResource.axd" negate="true" />
</conditions>
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
<rule name="Trailing Slash" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="true" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="true" negate="true" />
<add input="{URL}" pattern="WebResource.axd" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
<system.web>
<machineKey validationKey="843C54527BD577FCEEF69ABE5B4590BBDE5C035B26CB6B52920061F5221E640B4AB509E9CB22F254C37C1CADE017A34F7DD52582ECC97830F5B81FA954E8B6D0" decryptionKey="97327C072BDBA2FACFBD3526DBF6F277EE368B2DCEB76AE2E42D7538AD95CBFA" validation="SHA1" decryption="AES" />
<authentication mode="Windows">
</authentication>
<authorization>
<!-- <allow users="*" /> -->
<deny users="?" />
</authorization>
<compilation targetFramework="4.5" debug="true" batch="false" optimizeCompilations="true">
<assemblies>
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<customErrors mode="Off" />
<httpRuntime maxRequestLength="20480" />
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<location path="Account/LogOn">
<system.web>
<authorization>
<allow users="?" />
</authorization>
<httpModules>
<remove name="TExAuthentication" />
</httpModules>
</system.web>
<system.webServer>
<modules>
<remove name="TExAuthentication" />
</modules>
</system.webServer>
</location>
<location path="~/App_Themes">
<system.web>
<authorization>
<allow users="*" />
</authorization>
<httpModules>
<remove name="TExAuthentication" />
</httpModules>
</system.web>
<system.webServer>
<modules>
<remove name="TExAuthentication" />
</modules>
</system.webServer>
</location>
<location path="~/Content">
<system.web>
<authorization>
<allow users="*" />
</authorization>
<httpModules>
<remove name="TExAuthentication" />
</httpModules>
</system.web>
<system.webServer>
<modules>
<remove name="TExAuthentication" />
</modules>
</system.webServer>
</location>
<location path="~/Images">
<system.web>
<authorization>
<allow users="*" />
</authorization>
<httpModules>
<remove name="TExAuthentication" />
</httpModules>
</system.web>
<system.webServer>
<modules>
<remove name="TExAuthentication" />
</modules>
</system.webServer>
</location>
<location path="~/Scripts">
<system.web>
<authorization>
<allow users="*" />
</authorization>
<httpModules>
<remove name="TExAuthentication" />
</httpModules>
</system.web>
<system.webServer>
<modules>
<remove name="TExAuthentication" />
</modules>
</system.webServer>
</location>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="" sendTimeout="01:00:00">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<dotless minifyCss="false" cache="true" web="false" />
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>

ASP.NET MVC4 in development machine, while Click on Log Off error occured

I developed asp.net MVC 4 site. I had implemented CustomMembership and CustomRole things.
I am getting error while I click on LogOff button
error message:
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
this is my Web.Config file.
<membership defaultProvider="MyMembershipProvider">
<providers>
<clear/>
<add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
<add name="MyMembershipProvider" type="MvcApplicationTest.CustomMembershipProvider"
connectionStringName="ApplicationServices"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requireUniqueEmail="false"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLenth ="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow ="10"
applicationName ="MvcApplicationTest.Client.Web"
/>
</providers>
</membership>
<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>
<roleManager enabled="true" defaultProvider="MyRoleProvider">
<providers>
<clear/>
<add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData" />
<add name="MyRoleProvider" type="MvcApplicationTest.Models.CustomRoleProvider"/>
</providers>
</roleManager>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<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>
Thank You,

add forms authentication to mvc4 site created with empty template

I have a Mvc4 site that was created eith the empty template. How can I now include forms authentication to the site?
I have checked a few books and shearched but i have not come up with any relevant information.
my webconfig looks like this:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<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" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<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.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers></system.webServer>
<connectionStrings>
//
</connectionStrings>
</configuration>
Go to Web.config file in your project, check if the mode type for authentication is "Forms". See below:
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="20" />
</authentication>
</system.web>
The mode type for authentication have 4 defferent types, like below:
Windows
Forms
Passport
None
If you don't see <authentication> element in the Web.config file, add it inside the <system.web> element. Also because you're using empty templates, you need to add some logic for your Form based authentication. Like create Account Controller and Login Action.

Resources