473,396 Members | 1,734 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,396 software developers and data experts.

FormsAuthentication - <http://localhost> Works, <http://RealMachineName> Does Not

I have a test app where I have Forms Authentication set up.

When I build and run the app as http://localhost/testapp/login.aspx, it runs
correctly. I get the login prompt and the proper redirection to the secured
page.

When I run the app as http://<RealMachineName>/testapp/login.aspx, I get the
login page, but after logging in, I stay on the login page. The URL address
shows
http://<RealMachineName>/testapp/LoginPage.aspx?ReturnUrl=%2ftestapp%2fSecuredPage. aspx.

Can anyone tell me what I need to change here? Thanks.


Nov 18 '05 #1
3 2544
Good morning, Paul. Glad to know someone else works on Sunday morning.

Here's the authentication section of web.config:
........
<authentication mode="Forms">

<forms name="AuthCookie" loginUrl="LoginPage.aspx">

<credentials passwordFormat="Clear">

<user name="Tom" password="tucker" />

<user name="TomReal" password="tuckerreal" />

</credentials>

</forms>

</authentication>

........
Configuration section is:
...........
<configuration>

<location path="SecuredPage.aspx">

<system.web>

<authorization>

<allow users="Tom"/>

<deny users="?"/>

</authorization>

</system.web>

</location>

..........
Here's the code from the login page:
......................
Sub Login(obj as object, e as eventargs)
If (FormsAuthentication.Authenticate(txtUserName.Text ,
txtPassword.Text)) then FormsAuthentication.SetAuthCookie(txtUserName.Text ,
false)
Select Case txtUsername.Text
Case "Tom"
Response.Redirect ("SecuredPage.aspx")
Case Else Label4.Text = "Please contact Support. User "
& txtUserName.Text & " is not recognized."
End Select
Else
Label4.Text = "Sorry, invalid user name or password."
End If
End Sub

.....................
The IIS config for the site is:
Directory Security: Anonymous access set to IUSR_<RealMachineName>, IIS
controls password. Also set to Integrated Windows authentication.
Documents: Default documents set to (Default.htm,default.asp,
index.htm,iisstart.asp). I don't have any of those docs in the application.
My login page is loginpage.aspx, my application page is SecuredPage.aspx.
App permissions are set to: Read, Write, log visits.
Application settings are: Application name: TestApp
Execute permissions: Scripts only
Application Protection: Medium(pooled).

Let me know if there's another information that would be helpful.
Thanks for your help.

"Paul Glavich [MVP - ASP.NET]" <gl**@aspalliance.com-NOSPAM> wrote in
message news:%2******************@TK2MSFTNGP09.phx.gbl...
Need a bit mnore information on how yu have things setup. Can you provide
details on the contents of the autentication element in your web.config, as well as the IIS configuration for your *deployed* web site.

--
- Paul Glavich
Microsoft MVP - ASP.NET
"T. Regan" <tj*****@hotmail.com> wrote in message
news:8L******************@newsread2.news.atl.earth link.net...
I have a test app where I have Forms Authentication set up.

When I build and run the app as http://localhost/testapp/login.aspx, it

runs
correctly. I get the login prompt and the proper redirection to the

secured
page.

When I run the app as http://<RealMachineName>/testapp/login.aspx, I get

the
login page, but after logging in, I stay on the login page. The URL

address
shows

http://<RealMachineName>/testapp/LoginPage.aspx?ReturnUrl=%2ftestapp%2fSecuredPage. aspx.

Can anyone tell me what I need to change here? Thanks.


Nov 18 '05 #2
The response you are getting from the "real" machine looks like what you
should get if you went to:
http://<RealMachineName>/testapp/SecuredPage.aspx instead of the login page.
In that case, after authentication, you would use .redirectfromloginpage to
return to it.

"T. Regan" <tj*****@hotmail.com> wrote in message
news:8L******************@newsread2.news.atl.earth link.net...
I have a test app where I have Forms Authentication set up.

When I build and run the app as http://localhost/testapp/login.aspx, it runs correctly. I get the login prompt and the proper redirection to the secured page.

When I run the app as http://<RealMachineName>/testapp/login.aspx, I get the login page, but after logging in, I stay on the login page. The URL address shows
http://<RealMachineName>/testapp/LoginPage.aspx?ReturnUrl=%2ftestapp%2fSecuredPage. aspx.
Can anyone tell me what I need to change here? Thanks.

Nov 18 '05 #3
I'll try that, Rick. Thanks.

"Rick Spiewak" <ri*********@mindspring.com> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
The response you are getting from the "real" machine looks like what you
should get if you went to:
http://<RealMachineName>/testapp/SecuredPage.aspx instead of the login page. In that case, after authentication, you would use .redirectfromloginpage to return to it.

"T. Regan" <tj*****@hotmail.com> wrote in message
news:8L******************@newsread2.news.atl.earth link.net...
I have a test app where I have Forms Authentication set up.

When I build and run the app as http://localhost/testapp/login.aspx, it

runs
correctly. I get the login prompt and the proper redirection to the

secured
page.

When I run the app as http://<RealMachineName>/testapp/login.aspx, I get

the
login page, but after logging in, I stay on the login page. The URL

address
shows

http://<RealMachineName>/testapp/LoginPage.aspx?ReturnUrl=%2ftestapp%2fSecuredPage. aspx.

Can anyone tell me what I need to change here? Thanks.


Nov 18 '05 #4

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

Similar topics

11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
19
by: Kim André Akerř | last post by:
For some reason, I can't get the middle column of this setup to work properly in IE (go figure). It looks like it's supposed to in Opera and Firefox, but now I only need it to work in IE as well. ...
3
by: Jacob Crossley | last post by:
I have two web applications on the same server: http://localhost/ModemUpgrade and http://localhost/TestFormAuth The web.config of ModemUpgrade:
5
by: Jeff Johnson | last post by:
I'm using forms authentication to protect a subfolder within my site. I've got it working fine except for two issues: (1) When I do a RedirectFromLogin page I have to put a cookie path ("/"...
21
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript"...
8
by: chris_fieldhouse | last post by:
Hi fairly new to php, but picking it up quite well. the question I have, is it possible for a php script which is used to validate values submitted in a form, to then post these values onto...
8
by: michael | last post by:
Hi all A client of mine is having a problem with their site and when I looked into the SQL database, I found that most text fields have been altered and appended with script...
6
by: Guy Macon | last post by:
While I agree with the sentiment, the oringinal title on this thread ("OT: Specially for , why you should always use example.com for obfuscating domains") is wrong. There are other reserved domain...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.