473,378 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Forms Authentication for multiple applications

I have several applications all on the same server. I would like them
to all use the same login page.

Example:
http://server1/customers/app1.aspx
http://server1/suppliers/byregion/app2.aspx

I have a login page located in the root of the same server:
http://server1/login.aspx

None of these are virtual directories.

The web.config file for customers/ and suppliers/byregion/ looks like
this:

<authentication mode="Forms">
<forms loginUrl="/login.aspx" name=".ASPXAUTH" timeout="30" path="/"
protection="All">
</forms>
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>

The web.config for the root web looks like this
<authentication mode="Forms">
<forms loginUrl="login.aspx" name=".ASPXAUTH" timeout="30" path="/"
protection="All">
</forms>
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>

Both apps are configured to allow anonymous in iis.

The login page code looks like this:

Dim tkt As FormsAuthenticationTicket
tkt = New FormsAuthenticationTicket(1, Me.txtUser.Text, DateTime.Now(),
DateTime.Now.AddMinutes(30), True, "<group info would go here>")
Dim cookiestr As String
cookiestr = FormsAuthentication.Encrypt(tkt)
Dim ck As HttpCookie
ck = New HttpCookie(".ASPXAUTH", cookiestr)
ck.Expires = tkt.Expiration
ck.Path = "/"
Response.Cookies.Add(ck)
Dim strRedirect As String
strRedirect = Request("ReturnURL")
Response.Redirect(strRedirect)

When I request a page in customers, like
http://server1/customers/app1.aspx, I am redirected to the login page
(good), bet when I click logon and run the above code, it just returns
to the login page again (bad).
The "ReturnURL" is correct, as I have seen in debug mode.

I'm guessing that app1 is rejecting my cookie, and returning me to the
login page again, but why?

I must be missing something simple. Any ideas?

Nov 19 '05 #1
1 2508
If anyone is interested, I found the answer here.

http://weblogs.asp.net/hernandl/arch...formsauth.aspx

Basically, it had to do with the "IsolateApps" setting and the machine
key settings in the machine.config file.

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Hermit Dave | last post by:
Hi, I am making a web application (rather two applications) one which is host and used by customers when they are just browsing through products. The second application resides on a secure...
7
by: dave | last post by:
I have one application that is used within our intranet that places a forms auth cookie for our domain (for intranet purposes only). All other applications rely on this cookie for authentication and...
2
by: Brian Shannon | last post by:
I have an intranet site I created when I first began .NET and it is very basic. Now that I have developed my skills I am looking to revamp the old with something new. I really like the idea of...
2
by: Vaibhav Gadodia | last post by:
Hello, I am trying to build an application which has forms authnetication enabled. I have a non-persistent authentication cookie which is exactly what i want. The problem is when i use two...
1
by: Jéjé | last post by:
Hi, I have to implement a security like this: 1. The user is logged into a home made extranet in PHP, a directory server is used (not the active directory) (its a form based authentication) 2....
1
by: o0JoeCool0o | last post by:
I currently have forms authentication set up for my application, I have 2 different projects in the solution and I have one single login page residing in solution #1 My web.config is the same in...
2
by: o0JoeCool0o | last post by:
Has anyone else tried this? I have been messing with this for a week and cant figure it out, for some reason firefox will not read an authentication cookie unless it was set by the applciation...
4
by: David | last post by:
Hi all, I have a problem with Forms Auth. I am not using the protected folder method, rather, I want some parts of the page to be shown depending on the authentication state. Basically, I...
4
by: =?Utf-8?B?RmFyaWJh?= | last post by:
It know that we can use the following method http://msdn2.microsoft.com/en-us/library/eb0zx8fc.aspx to form authenticate across multiple applications. I have created an asp.net application...
2
by: TimVtoo | last post by:
Hi, thanks for your time. I have 2 almost identical asp.net (vb) applications. 1 Development and 1 Production. They use forms authentication that is configured to run in SQL server. Both apps...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.