Http Error While Redirecting Url

gopal2006

Well-known member
Joined
Feb 1, 2006
Messages
63
Programming Experience
1-3
Hi all


I am not that proficient in ASP.NET. Here I have a problem. I am doing authentication of the login form. Look at my code below.

IN the web.config file

<authentication mode="Forms">
<forms name="login.aspx" loginUrl=".ASPXAUTH">
<credentials passwordFormat="Clear">
<user name="devhood" password="password"/>
</credentials>
</forms>
</authentication>
<authorization>
<allow users="devhood"/>
<deny users="?"/>
</authorization>


Now I want to dispaly another form webform1.aspx when submit button in the login form is clicked. My code is as below

private sub button1_click(
ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

if formsauthentication.authenticate(txtusername.text,txtpassword.text) then

formsauthentication.redirectfromloginpage(txtusername,false)
else
'error message'

end if
end sub

But when I click the submit button it throws the error
"Error\n application
HTTP error 404

check the following url
\default.aspx"


Just let me know where I am making mistake . Is there any mistake in my authentication setting procedure. I feel I am making some mistake in the authentication procedure.

Thaks for help in advance.
 
of course you get the error 404 (page not found) cuz there is not file named ".ASPXAUTH".
Just back there and change the loginUrl.
Means it suppose to look like this:
VB.NET:
<authentication mode="Forms">
<forms name="ASPXAUTH" loginUrl="Login.aspx" protection="All" />
{...}
Now try again ... lol

Regards ;)
 
Now no error

Thanks Mr Kulrom. Now I am not getting that error. But one more problem I am having. After clicking on submit button it is not redirected to another page. Nothing happens. can you suggest some code corrections?:)
 
Well i can't be much of help unless i see the code how you authenticate the users ... but notice that this is kinda usually way:
Means, after you've verified the user's password and user ID are correct, you need to execute "FormsAuthentication.RedirectFromLoginPage(...)".
If you have missed this part then try again adding it.
Otherwise post the code !
 
The code is above

Yes Mr Kulrom. You are right. The code is in my first post. So I want to know if I am missing anything there. If I have missed anyhitng I want some sample code. Can you provide me with some sample code?
 
Sholud i write the same code in HTML view

Mr Kulrom sorry for disturbing you again. I want to know one more thing whether I should write the above piece of code in HTML view also?:confused:
 
ok sorry for the delay :(
My recommendation for you will be to follow security wizard which is best way for beginners to manage all the security settings for your application.
Means open your project in VS.NET and select mainmenu item "Website" then from the list select ASP.NET Configuration ... now click the security tab and locate the link Use the security Setup Wizard to configure security step by step.
You will figure out the rest of the job you need to do ... following the wizard of course ;)
 
Thaks

Ok Mr Kulrom I will check this out. I am using VS.net 2003. Is the feature you mentioned is available in vs.net 2003? Of course I had forgotten to tell you one thing. Since IIS on my machine is having some problem I am running web applications using ASP.NET Web Matrix. Will ASP.NET applications run smoothly on Web Matrix?
 
Back
Top