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

redirection from the Login Page

Hi EveryBody:

I face problme in my web application that made by ASP.Net the code behined
is Vb.Net.

The problem is insated of using the App_Data folder in the solution explorer
I used mu own Database that located into my machin which is the local host.

I used create user wizerd to creat the user and I made the connection tom
the database to safe the user name and password inside it the process work
well and.

But when I want to retrive the data from the database to make the
authentication I make the connection to the data base and I check from the
username and password but the only proble do I have is that the Destination
URL is alway going to the Login.aspx and faulier action takedplace and
faulier message I recived.

This is my connection in the web.confug:

<connectionStrings>
<add name="husamConnection" connectionString="Data
Source=localhost;Initial Catalog=Husam;Persist Security Info=True;Integrated
Security=SSPI" providerName="System.Data.SqlClient"/>
</connectionStrings>

and my code is:

<%@ IMPORT Namespace ="System.Data" %>
<%@ IMPORT Namespace ="System.Collections" %>
<%@ IMPORT Namespace ="System.Collections.Generic" %>
<%@ IMPORT Namespace ="Microsoft.VisualBasic" %>
<%@ IMPORT Namespace ="System.Data.SqlClient" %>
<%@ IMPORT Namespace ="Microsoft.SqlServer.Management.Common" %>
<%@ IMPORT Namespace ="Microsoft.SqlServer.Management.Smo" %>

<SCRIPT runat="server">

Function SiteSpecificAuthenticationMethod(ByVal UserName As String,
ByVal Password As String) As Boolean
Dim cmd As SqlCommand
Dim scon As SqlConnection = New
SqlConnection(ConfigurationManager.ConnectionStrin gs("husamConnection").ConnectionString)
Dim sql As String
Dim rawan As New List(Of String)
Dim rawan1 As New List(Of String)
Try
scon.Open()
sql = "SELECT user_Name,user_Password FROM husam_Tab"
cmd = New SqlCommand(sql, scon)
cmd.ExecuteNonQuery()
Dim myReader As SqlDataReader = cmd.ExecuteReader()
While (myReader.Read())
rawan.Add(myReader.GetString(0))
rawan1.Add(myReader.GetString(1))
End While
myReader.Close()
scon.Close()
If rawan.Contains(UserName) Then
If rawan1.Contains(Password) Then
MsgBox("welcom to access")
Response.Redirect("~/MemberShipFolder/MemberArea.aspx",
True)
'Login1.DestinationPageUrl =
"~/MemberShipFolder/MemberArea.aspx"
Else
Login1.FailureText = "Your password is not correct"
'Login1.FailureAction = LoginFailureAction.Refresh
End If
Else
MsgBox("Your user name is not correct")
End If
Catch ex As Exception
End Try
Return False
End Function

Sub OnAuthenticate(ByVal sender As Object, ByVal e As
AuthenticateEventArgs)
Dim Authenticated As Boolean
Authenticated = SiteSpecificAuthenticationMethod(Login1.UserName,
Login1.Password)
e.Authenticated = Authenticated
End Sub
</SCRIPT>
May 26 '07 #1
0 915

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

Similar topics

1
by: Nick Whitelegg | last post by:
Hello, I'm having an odd problem with combining an authentication session variable with header() redirection. Basically I have an authentication script which checks a username/password. If the...
2
by: TJ Talluto | last post by:
Hi, I'm using the curl functions in php to scrape the wan ip address from my home router (the router is an SMC product). This is a two step process: 1. post the password value to the login.htm...
1
by: S | last post by:
Hi, I am making a webcrawler and it needs to go through the login on the front page. I use LWP:UserAgent and HTML::Form to basically post the username and password to the site. Once past the...
0
by: Mike | last post by:
I can not figure out what is going on here. I hope somebody can please help!!! I've got an intranet ASP3 application running on a Win2k server. This application requires a login, so the user...
0
by: itsharkopath | last post by:
Hi, Imagine a user in a hotspot, when he comes to the hotspot and tries to load a webpage (on the internet), he would automatically redirected to login page. I believe the following is to be...
0
by: doctordandy | last post by:
I am fairly new to this, but basically the gist of the problem is that I have a login page which Is supposed to redirect to a customer account page once the username and password are validated,...
2
by: fReDiNi | last post by:
Hi, I have an strange problem with session variables. I have a site hosted in a local server. I have physic access to this server and its configuration.(apache, php,files...). I have external...
7
by: kavin | last post by:
Hi How to redirect to a url of a site's particular page.I had tried like this in my prog. Is it correct? Redirection url:...
9
by: Nick | last post by:
Hi there, I'm passing an HTML encoded string to an URL in the query parameter. This query string works perfect in the website if you are already logged on, if you are not logged on the...
33
by: rvj | last post by:
if you redirect on an IIS , must the client url address bar always be updated with the new address. what options are? Q1 if a user requests http://old.com , is there a method of ASP...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.