Results 1 to 4 of 4

Thread: Forms Authentication Problem?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    The Twilight Zone
    Posts
    295

    Forms Authentication Problem?

    Hi,

    I have conducted a search on the forum just to see if anybody else has experienced this problem and i couldn't find any similar posts. Here goes. I have set up a basic Forms autheentication. See below:

    Code:
    	private void Button1_Click(object sender, System.EventArgs e)
    		{
    			if (txtUsername.Text == "????" && txtPassword.Text == "?????")
    			{
    				FormsAuthentication.RedirectFromLoginPage("LoggedIn", false);
    			}
    			else
    			{
    				lblLoggedin.Text = "Login falied";
    			}
    
    		}
    The web.config file:

    Code:
    <configuration>
        <system.web>
            <customErrors mode="Off"/>
    	<authentication mode="Forms" /> 
    	 <authorization>
            	<deny users="?" /> 
        	</authorization>
        </system.web>
    </configuration>
    Now this all works on my localhost, however as soon as i upload my webconfig file onto my webserver i get the following error:

    Code:
    RUNTIME ERROR
    <!-- Web.Config Configuration File -->
    
    <configuration>
        <system.web>
            <customErrors mode="Off"/>
        </system.web>
    </configuration>
    
    <!-- Web.Config Configuration File -->
    
    <configuration>
        <system.web>
            <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
        </system.web>
    </configuration>
    I am totally stumped to whats wrong here?

    As always any help is greatly appreciated.

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: Forms Authentication Problem?

    On the target Web folder, has your application's folder been CREATEd in IIS as a virtual application??

    Does it work if you load the pages to the highest level (root) folder of the Web server and run them from there? (not in their own subfolder)
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    The Twilight Zone
    Posts
    295

    Re: Forms Authentication Problem?

    Lord_Rat, thanks for your suggestion. I put all the pages in the root as you suggested and it works, why is this? For future projects, how would i get it to work should i put the pages in a subfolder?

    Thanks!!!

  4. #4
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: Forms Authentication Problem?

    Because every dot-net app needs to reside (as its base) in the highest folder that was CREATEd as a IIS application. The root automatically is, the rest has to be done by hand.

    Speak with your Web host on this one.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width