I am trying to create a simple login form on giving correct username and password the form is not tranferring to the next page it just remains in the same page.And my code is

<script runat="server">
sub Page_Load
If txtuname.Text="xxx"  AND txtpass.Text="xxx" Then
Response.write("Welcome user")
Server.Transfer("login2.aspx")
Else
Response.write("Invalid Username and Password")
End If
End sub
</script>

Recommended Answers

All 3 Replies

You need to look into using forms authentication in asp.net

Please read this.

I got the output:
and the code is

<script runat="server">
sub Page_Load
If txtuname.Text="karthi"  AND txtpass.Text="karthi" Then
response.write("Welcome user")
response.redirect("login2.aspx")
Else
response.write("Invalid Username and Password")
End If
End sub
</script>

So what's happening with your code? Is the page load block you added not triggering? Are you at least getting a postback? Seeing the rest of your code would be helpful.

I agree with Begginnerdev that this approach is not the best choice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.