473,473 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Basic Login Problem

Ben
Hi

I have the below code and am having problems with it, i get transferred to
the logindenied.aspx whether the credentials are correct or not.

Also once authenticated I want to forward the user to auth.aspx. How would
I do this?

Any help would be much appreciated.

Thanks B

Private Sub LoginButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LoginButton.Click

If FormsAuthentication.Authenticate(UsernameTextBox.T ext,
PasswordTextBox.Text) Then

FormsAuthentication.RedirectFromLoginPage(Username TextBox.Text, True)

Else

Server.Transfer("logindenied.aspx")

End If

End Sub

web.config........................

<authentication mode="Forms">

<forms name="appNameAuth" path="/" loginUrl="adminlogin.aspx"
protection="All" timeout="15">

<credentials passwordFormat="SHA1" >

<user name="myusername" password="myPassword"/>

< /credentials>

</forms>

</authentication>
Nov 19 '05 #1
4 2825
Hello
Dear Ben

Plz change your passwordFormat type in Web.config File to "Clear"
as it expects the Password in SHA1 encryped format..which you not writed in
web.config file.

thanks
Malik Asif

"Ben" <Be*@NoSpam.com> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Hi

I have the below code and am having problems with it, i get transferred to
the logindenied.aspx whether the credentials are correct or not.

Also once authenticated I want to forward the user to auth.aspx. How would I do this?

Any help would be much appreciated.

Thanks B

Private Sub LoginButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LoginButton.Click

If FormsAuthentication.Authenticate(UsernameTextBox.T ext,
PasswordTextBox.Text) Then

FormsAuthentication.RedirectFromLoginPage(Username TextBox.Text, True)

Else

Server.Transfer("logindenied.aspx")

End If

End Sub

web.config........................

<authentication mode="Forms">

<forms name="appNameAuth" path="/" loginUrl="adminlogin.aspx"
protection="All" timeout="15">

<credentials passwordFormat="SHA1" >

<user name="myusername" password="myPassword"/>

< /credentials>

</forms>

</authentication>

Nov 19 '05 #2
you have specified passwordFormat="SHA1". However, the passwords are
clearly not encoded with SHA1. either encode the passwords in the config
file or use passwordformat="Clear"
"Ben" <Be*@NoSpam.com> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Hi

I have the below code and am having problems with it, i get transferred to
the logindenied.aspx whether the credentials are correct or not.

Also once authenticated I want to forward the user to auth.aspx. How
would I do this?

Any help would be much appreciated.

Thanks B

Private Sub LoginButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LoginButton.Click

If FormsAuthentication.Authenticate(UsernameTextBox.T ext,
PasswordTextBox.Text) Then

FormsAuthentication.RedirectFromLoginPage(Username TextBox.Text, True)

Else

Server.Transfer("logindenied.aspx")

End If

End Sub

web.config........................

<authentication mode="Forms">

<forms name="appNameAuth" path="/" loginUrl="adminlogin.aspx"
protection="All" timeout="15">

<credentials passwordFormat="SHA1" >

<user name="myusername" password="myPassword"/>

< /credentials>

</forms>

</authentication>

Nov 19 '05 #3
Ben
Thank you both,

Now it forwards me to default.aspx when authenticated, is there any method
of specifying where to forward when setting the user as authenticated?

Thanks
B

"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:eI****************@TK2MSFTNGP09.phx.gbl...
you have specified passwordFormat="SHA1". However, the passwords are
clearly not encoded with SHA1. either encode the passwords in the config
file or use passwordformat="Clear"
"Ben" <Be*@NoSpam.com> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Hi

I have the below code and am having problems with it, i get transferred
to the logindenied.aspx whether the credentials are correct or not.

Also once authenticated I want to forward the user to auth.aspx. How
would I do this?

Any help would be much appreciated.

Thanks B

Private Sub LoginButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LoginButton.Click

If FormsAuthentication.Authenticate(UsernameTextBox.T ext,
PasswordTextBox.Text) Then

FormsAuthentication.RedirectFromLoginPage(Username TextBox.Text, True)

Else

Server.Transfer("logindenied.aspx")

End If

End Sub

web.config........................

<authentication mode="Forms">

<forms name="appNameAuth" path="/" loginUrl="adminlogin.aspx"
protection="All" timeout="15">

<credentials passwordFormat="SHA1" >

<user name="myusername" password="myPassword"/>

< /credentials>

</forms>

</authentication>


Nov 19 '05 #4
"Ben" <Be*@NoSpam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thank you both,

Now it forwards me to default.aspx when authenticated, is there any method
of specifying where to forward when setting the user as authenticated?

you can invoke LoginPage.aspx?ReturnUrl=<your main page>. however, this will
not work if the user just goes directly to the login page.

alternatively, instead of using RedirectFromLoginPage() you can call
SetAuthCookie() and then do your own redirect

however, as best practice I would normally recommend:

1. have the "home page" of your app called default.aspx

2. make sure IIS knows this is the default page (so the user can leave off
the /default.aspx if they want)

3. don't explicitly link to the login page; link to default.aspx instead and
this will automatically go through the login process if they aren't logged
in
Thanks
B


Nov 19 '05 #5

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

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
6
by: Magnus Jardeby | last post by:
I have a problem with basic authentication. I redirect a user from a page to another. I don't want to get the NT prompt login, I want the user to be logged in automatically. I want to send the...
4
by: Joseph | last post by:
I have an intranet application that I setup using windows authentication through IIS basic authentication. Is there a way to set a timeout, so that after ten minutes the user will be prompted...
4
by: Dave | last post by:
Hi, Is there anyway to mimic forms authentication's loginUrl and RedirectFromLoginPage functionality using Windows authentication? We are developing intranet sites using basic authentication...
6
by: Erez Shor | last post by:
Hi, I need to build and asp page which access a remote windows server's registry and create a registry key. In order for the ASP page to be able to access the registry on the remote server I need...
4
by: Barry | last post by:
The MS fix for IE broke how users access our site (if they patch their browsers), so I need a solution to get users logged onto our site transparently. Basically we used to log on to the site...
3
by: Chris Kennedy | last post by:
Got everything working in my application including database security. The final thing I am having a problem with is: When a user goes to the application page they are redirected to the login page...
3
by: sefe dery | last post by:
hi ng, i try to create a asp.net 1.0 website on windows server 2003(Servername: ServerX) with iis 6.0. PROBLEM: The user should login with his windows credentials in basic.aspx and...
2
by: =?Utf-8?B?d2NtY2FsaXN0ZXI=?= | last post by:
Hello all, I have a c# web application that is supposed to redirect the user to another website that is basically a black box to me. All I know is that it uses basic authentication and that...
0
by: DanWeaver | last post by:
Hi, I am going mad with this. I seem to have some kind of session problem. Login SEEMS to work (and login event is recorded sucessfuly in DB (MSSQL on shared server)) but asp pages behave as...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.