1

I have created created 2 separate Asp.Net Application.
App 1: Admin
App 2: Reports

We already hosted Admin Application in IIS 7.0. Now I need to provide a link in Admin Application to link to Reports App, where in which i should not login again to Reports app.

Now I have created virtual directory for Reports in IIS under Admin App. So my question is how to provide a common Authentication for both Applications.??
Note: I am Using Forms Authentication

Thanks in Advance

0

4 Answers 4

3

You need to do three things in the configuration, and each application must match:

  • Have the same Application attribute in the membership and role providers and use the same database: applicationName attribute on add child of provider child of membership and roleManager. This means authentication and authorisation data will be shared.

  • Have the same keys to encrypt and validate authentication cookies (on the machineKey element). (This also means logins will survive app pool restarts because new keys won't be generated on each app start.)

  • Have both apps use the same name attribute on the forms element so the same cookie is used.

[Updated with third point after finding the rigth attribute.]

1
  • @Jupaol: No. I have used points 1 & 2, but not the third part. AlsoL anyone just using some information from the web without testing gets what they deserve.
    – Richard
    Aug 1, 2012 at 14:23
2

You may want an application instead of virtual directory under the admin app.

You will need to set enableCrossAppRedirects="true" in the web.config

Both apps should share a common machineKey. Here's a tool to generate a machineKey: http://aspnetresources.com/tools/machineKey

Sample web.config entries:

<authentication mode="Forms">
  <forms name=".ASPNETAUTH"
      enableCrossAppRedirects="true"
      loginUrl="Login.aspx"
      protection="All"
      path="/"
      timeout="60" />
</authentication>


<machineKey validationKey='F1D92DF9B41E5D94E79946A10494F52FF26956F256667DB52E9FA9B30E6A4FF61E4C05F1AC2795330F34B7B1389E1BD75FD0D3DCD12E991BD09B9AD004C0FE0D'
            decryptionKey='B8940FB4A776EABD1525E7D9B58E9E5DE057B2F2A67AA913'
            validation='SHA1'/>
1

I think you shoul take a look at PreApplicationStartMethodAttribute and Managed Extensibility Framework Overview

1

The key is that you need to use the same machine key, validation key and decryption key in each of the web.config files.

Also, make sure all of your forms auth parameters match in each file.

The reports app should direct to the Admin app's login page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.