I am redirecting using different roles superadmin,hr assistant etc to aspx pages with in folders respectively..But in foreign iis

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
    <configSections>
        <sectionGroup name="devExpress">
            <section name="settings" type="DevExpress.Web.ASPxClasses.SettingsConfigurationSection, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
            <section name="compression" type="DevExpress.Web.ASPxClasses.CompressionConfigurationSection, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
            <section name="themes" type="DevExpress.Web.ASPxClasses.ThemesConfigurationSection, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
            <section name="errors" type="DevExpress.Web.ASPxClasses.ErrorsConfigurationSection, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
        </sectionGroup>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <section name="ResumeManager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
        </sectionGroup>
    </configSections>
    <appSettings>
        <!--<add key="connect" value="server=ZS-SERVER;Initial Catalog=ResumeNakilat;User ID=sa;Password=star@123;Connect Timeout=200; pooling='true';Max Pool Size=200" />-->
        <!--<add key="connect" value="server=ZS-SERVER;Initial Catalog=resumedbzaina;User ID=sa;Password=star@123;Connect Timeout=200; pooling='true';Max Pool Size=200"/>-->
        <add key="connect" value="server=SOUTHERN-PC;Initial Catalog=resumedbzaina;User ID=sa;Password=sa;Connect Timeout=200; pooling='true';Max Pool Size=200"/>
        <!--<add key="connects" value="server=ZS-SERVER;Initial Catalog=resumedbzaina;User ID=sa;Password=star@123"/>-->
    <add key="connects" value="server=SOUTHERN-PC;Initial Catalog=resumedbzaina;User ID=sa;Password=sa"/>
        <add key="SMTPServer" value="mail.zainasoft.com"/>
        <add key="FromAddressInfo" value="careers@zainasoft.com"/>
        <add key="SMTPCredentialUser" value="careers@zainasoft.com"/>
        <add key="SMTPCredentialPass" value="password"/>
    <add key="autoFormsAuthentication" value="false" />
    <add key="enableSimpleMembership" value="false"/>
        <add key="MailBee.Global.LicenseKey" value="MN700-0123456789ABCDEF-0123"/>
        <add key="ChartImageHandler" value="storage=file;timeout=20;"/>
        <add key="FolderPath" value="RecruiterCandidatedocs"/>
    </appSettings>
    <connectionStrings>
  <add name="ConnectionString" connectionString="Data Source=SOUTHERN-PC;Initial Catalog=resumedbzaina;User ID=sa;Password=sa;Connect Timeout=200; pooling='true'; Max Pool Size=200"
   providerName="System.Data.SqlClient" />
  <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
   providerName="System.Data.SqlClient" />
  <add name="resumedbzainaConnectionString" connectionString="Data Source=ZS-SERVER;Initial Catalog=resumedbzaina;User ID=sa"
   providerName="System.Data.SqlClient" />
  <add name="resumedbzainaConnectionString1" connectionString="Data Source=ZS-SERVER;Initial Catalog=resumedbzaina;Persist Security Info=True;User ID=sa;Password=star@123"
   providerName="System.Data.SqlClient" />
  <add name="ConnectionString2" connectionString="Expression: XtraCarsConnectionString"
   providerName="System.Data.SqlClient" />
  <add name="resumedbzainaConnectionString2" connectionString="Data Source=ZS-SERVER;Initial Catalog=resumedbzaina;User ID=sa;Password=star@123"
   providerName="System.Data.SqlClient" />
  <add name="resumedbzainaConnectionString3" connectionString="Data Source=FAIZREHAN-PC\SQLEXPRESS;Initial Catalog=resumedbzaina;Persist Security Info=True;User ID=sa"
   providerName="System.Data.SqlClient" />
  <add name="resumedbzainaConnectionString4" connectionString="Data Source=SOUTHERN-PC;Initial Catalog=resumedbzaina;User ID=sa;Password=sa"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
    <system.web>
    <identity impersonate="true"/>
        <pages controlRenderingCompatibilityVersion="3.5" validateRequest="false" clientIDMode="AutoID">
            <controls>
                <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            </controls>
        </pages>
        <sessionState mode="InProc" timeout="525600"></sessionState>
        <customErrors mode="Off"/>
        <compilation debug="true" targetFramework="4.0">
            <assemblies>
                <add assembly="DevExpress.Web.ASPxEditors.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.Web.ASPxThemes.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.Data.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.XtraReports.v12.1.Web, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="DevExpress.Printing.v12.1.Core, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.XtraReports.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.Utils.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.XtraCharts.v12.1.Web, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.Web.ASPxEditors.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.Data.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.Web.ASPxGridView.v12.1.Export, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.XtraPrinting.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="DevExpress.Web.ASPxScheduler.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
                <add assembly="DevExpress.XtraScheduler.v12.1.Core, Version=12.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/></assemblies>
        </compilation>
        <authentication mode="Forms">
            <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
        </authentication>
        <membership defaultProvider="AspNetSqlMembershipProviderRelaxed">
            <providers>
                <clear/>
                <add connectionStringName="ConnectionString" applicationName="/" maxInvalidPasswordAttempts="10" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" passwordStrengthRegularExpression="" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" name="AspNetSqlMembershipProviderRelaxed" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
        </membership>
        <roleManager enabled="true">
            <providers>
                <clear/>
                <remove name="AspNetSqlRoleProvider"/>
                <add name="AspNetSqlRoleProvider" connectionStringName="ConnectionString" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
        </roleManager>
        <httpRuntime requestValidationMode="2.0" maxRequestLength="102400" executionTimeout="3600"/>
        <httpModules>
            <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
        </httpModules>
        <httpHandlers>
            <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
            <add path="ASPxUploadProgressHandlerPage.ashx" verb="GET,POST" type="DevExpress.Web.ASPxUploadControl.ASPxUploadProgressHttpHandler, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" validate="false"/>
            <add path="DX.ashx" verb="GET,POST" type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" validate="false"/>
        </httpHandlers>
    </system.web>
    <system.webServer>
        <defaultDocument enabled="true">
            <files>
                <clear/>
                <add value="Login.aspx"/>
            </files>
        </defaultDocument>
        <modules runAllManagedModulesForAllRequests="true">
            <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
        </modules>
        <validation validateIntegratedModeConfiguration="false"/>
        <handlers>
            <remove name="ChartImageHandler"/>
            <add type="DevExpress.Web.ASPxUploadControl.ASPxUploadProgressHttpHandler, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="ASPxUploadProgressHandlerPage.ashx" name="ASPxUploadProgressHandler" preCondition="integratedMode"/>
            <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v12.1, Version=12.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="DX.ashx" name="ASPxHttpHandlerModule" preCondition="integratedMode"/>
            <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </handlers>
        <httpProtocol>
            <customHeaders>
                <clear/>
                <add name="X-UA-Compatible" value="IE=9"/>
            </customHeaders>
        </httpProtocol>
    </system.webServer>
    <devExpress>
        <settings rightToLeft="false"/>
        <compression enableHtmlCompression="false" enableCallbackCompression="true" enableResourceCompression="true" enableResourceMerging="false"/>
        <themes enableThemesAssembly="true" styleSheetTheme="" theme=""/>
        <errors callbackErrorRedirectUrl=""/>
    </devExpress>
    <applicationSettings>
        <ResumeManager.Properties.Settings>
            <setting name="ResumeManager_localhost_WebService1" serializeAs="String">
                <value>http://localhost:51919/WebService1.asmx</value>
            </setting>
        </ResumeManager.Properties.Settings>
    </applicationSettings>
</configuration>

server it keeps me redirecting as zainasoft/Account/Login.aspx?ReturnUrl=%2fzainasoft%2fHRManager%2fDashboard.aspx ....

I am actualy redirecting to HRManager/Dashboard.aspx......

Dani AI

Generated

Short summary and root‑cause checklist (based on post and 's suggestion to keep the example minimal):

When a protected page is being sent back to the login page instead of the intended dashboard the behavior itself is normal for Forms Authentication; the problem is that the application never ends up with a valid auth ticket for the dashboard request. Common causes are: the auth cookie is not being created or has the wrong Path/Domain/Secure flags, redirects are built with the wrong relative paths when the app runs in a virtual directory, the virtual folder in IIS is not an application, or encrypted tickets fail to decrypt across servers (no explicit machineKey in a web farm).

Immediate checks and fixes

  • Confirm the auth cookie is actually issued: use browser DevTools (Application/Storage -> Cookies) or Fiddler and look for a Set-Cookie for the auth ticket after successful login. If no cookie is present, the login code is not creating it.
  • When the site runs under a virtual directory, avoid plain relative redirects. Resolve the app-root path before redirecting:
FormsAuthentication.SetAuthCookie(username, false);
var returnUrl = Request.QueryString["ReturnUrl"];
if (String.IsNullOrEmpty(returnUrl) || !returnUrl.StartsWith("/"))
    returnUrl = ResolveUrl("~/HRManager/Dashboard.aspx");
Response.Redirect(returnUrl);
  • Ensure the virtual folder is configured as an IIS Application (IIS Manager -> convert to Application). Authentication and cookie path behavior depends on the app root.
  • If using multiple servers/load balancer, set an explicit identical machineKey in each server’s web.config so auth tickets can be decrypted everywhere.
  • Check IIS authentication settings: the login page must be served anonymously; Windows Auth should only be enabled if intentionally mixing schemes.

Diagnostics to run

  • Watch the 302 responses and Set-Cookie header (Fiddler/DevTools). Verify the subsequent request actually sends the cookie, and inspect cookie Path, Domain and Secure attributes.
  • If the cookie is present but ignored, confirm the cookie Path matches Request.ApplicationPath and that SSL settings (requireSSL) aren’t preventing storage.

Missing details that make a quick diagnosis possible: the actual login code-behind (how the ticket/cookie is created), any <authorization> or <location> entries that affect the HRManager folder, whether the app is a converted IIS Application, IIS version, and whether a web farm is in use. Also avoid posting production connection strings/passwords in public; rotate any credentials if already exposed.

It would be helpful if you are a bit more clear on what the problem is and only post revelant code.

Can you clarify as to what the problem is? You are being redirected to the wrong URL?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.