Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Wednesday, March 28, 2012

Long Running Query - Only from .NET

I have a pretty complex query that aggregates lots of data and inserts multiple rows of that data into a reporting table. When I call this SPROC from SQL Server Management Studio, it executes in under 3 seconds. When I try to execute the same SPROC using .NET's SqlCommand object the query runs indefinitely until the CommandTimeout is reached.

Why would this SPROC behave differently with the same inputs, but being called from .NET?


Thanks for your help!

Turn on debugging, make sure the query isn't causing exception.

ERic

|||

I am debugging in .Net, I don't get an exception until the Timeout is reached.

|||

I fixed it! It was the return method. I was using 'RETURN @.@.ROWCOUNT' rather than 'SELECT @.@.ROWCOUNT'

Thanks for your help

Long Running Queries in Procedure

derek@.programmer.net May 19, 12:57 pm show options
From: "d...@.programmer.net" <d...@.programmer.net> - Find messages by this
author
Date: Thu, 19 May 2005 09:57:29 -0700
Local: Thurs,May 19 2005 12:57 pm
Subject: Long Running Queries in Procedure
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse
Hi,
Has anyone ever seen a query take longer in a stored procedure than it
does when running in Query Analyzer? I have a set of about 10 queries
that run for 18 minutes when running in a schedule job (which runs a
stored procedure) but only for about 4 minutes when I run them manually
in Query Analyzer.
I'm trying to trim time out of a daily procedure that takes about 3
hours and I've already done some performance tuning - that's why I know
how long they take in Query Analyzer. However, when I time how long
the individual portions of the proc run - I get different results than
those I receive when I run the queries myself.
Any thoughts?
DerekUse SQL Server Profiler to monitor performance related events. Whatever, the
issue it will turn up there.
"Derek Fisher" <DerekFisher@.discussions.microsoft.com> wrote in message
news:E1976E3E-7CF3-4475-8600-6FEFA92370B8@.microsoft.com...
> derek@.programmer.net May 19, 12:57 pm show options
> From: "d...@.programmer.net" <d...@.programmer.net> - Find messages by this
> author
> Date: Thu, 19 May 2005 09:57:29 -0700
> Local: Thurs,May 19 2005 12:57 pm
> Subject: Long Running Queries in Procedure
> Reply | Reply to Author | Forward | Print | Individual Message | Show
> original | Remove | Report Abuse
> Hi,
>
> Has anyone ever seen a query take longer in a stored procedure than it
> does when running in Query Analyzer? I have a set of about 10 queries
> that run for 18 minutes when running in a schedule job (which runs a
> stored procedure) but only for about 4 minutes when I run them manually
> in Query Analyzer.
>
> I'm trying to trim time out of a daily procedure that takes about 3
> hours and I've already done some performance tuning - that's why I know
> how long they take in Query Analyzer. However, when I time how long
> the individual portions of the proc run - I get different results than
> those I receive when I run the queries myself.
>
> Any thoughts?
>
> Derek
>
>|||Did you looked for locks on tables ? Are your queries very "cost" intensive
or "lock" intensive ?
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Derek Fisher" <DerekFisher@.discussions.microsoft.com> schrieb im
Newsbeitrag news:E1976E3E-7CF3-4475-8600-6FEFA92370B8@.microsoft.com...
> derek@.programmer.net May 19, 12:57 pm show options
> From: "d...@.programmer.net" <d...@.programmer.net> - Find messages by this
> author
> Date: Thu, 19 May 2005 09:57:29 -0700
> Local: Thurs,May 19 2005 12:57 pm
> Subject: Long Running Queries in Procedure
> Reply | Reply to Author | Forward | Print | Individual Message | Show
> original | Remove | Report Abuse
> Hi,
>
> Has anyone ever seen a query take longer in a stored procedure than it
> does when running in Query Analyzer? I have a set of about 10 queries
> that run for 18 minutes when running in a schedule job (which runs a
> stored procedure) but only for about 4 minutes when I run them manually
> in Query Analyzer.
>
> I'm trying to trim time out of a daily procedure that takes about 3
> hours and I've already done some performance tuning - that's why I know
> how long they take in Query Analyzer. However, when I time how long
> the individual portions of the proc run - I get different results than
> those I receive when I run the queries myself.
>
> Any thoughts?
>
> Derek
>
>|||JT,
This will probably sound like a stupid question, but I'm unfamiliar with
using Profiler. Do you have any suggestions on how to setup the trace - wha
t
events to add, etc? If not, any suggestions on helpful articles about the
Profiler?
Derek
"JT" wrote:

> Use SQL Server Profiler to monitor performance related events. Whatever, t
he
> issue it will turn up there.
> "Derek Fisher" <DerekFisher@.discussions.microsoft.com> wrote in message
> news:E1976E3E-7CF3-4475-8600-6FEFA92370B8@.microsoft.com...
>
>|||Jens,
I'm not sure how to know. How would I tell?
Derek
"Jens Sü?meyer" wrote:

> Did you looked for locks on tables ? Are your queries very "cost" intensiv
e
> or "lock" intensive ?
> --
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
> "Derek Fisher" <DerekFisher@.discussions.microsoft.com> schrieb im
> Newsbeitrag news:E1976E3E-7CF3-4475-8600-6FEFA92370B8@.microsoft.com...
>
>|||You can use the statemtent sp_lock and sp_who and sp_who2 to identify the
blockings issue (if you have one). ANother oprtion would be to monitor the
events in the profiler, just check on the lock properties to monitor. If you
are not familiar with the profiler you can look in the current activitie in
your EM, to see wheter a lock or perhaps deadlocks occured.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Derek Fisher" <DerekFisher@.discussions.microsoft.com> schrieb im
Newsbeitrag news:C80C8BFB-3227-4306-AB80-B7DB2F34B695@.microsoft.com...
> Jens,
> I'm not sure how to know. How would I tell?
> Derek
> "Jens Smeyer" wrote:
>

Wednesday, March 21, 2012

LogOnInfo is not a member of Schools.Table.

Hello,

I am gettign an error while I am using Crystal Report 9 with asp.net 1. Actually, till yesterday I it was working fine and today, I have changed the position of my computer. I don't know what happened. Please help.

Error is

1) C:\Schooloutlook\FormFile\Report\MForm7.aspx.vb(77): 'LogOnInfo' is not a member of 'Schools.Table'.

2) C:\Schooloutlook\FormFile\Report\MLocalDensity.aspx.vb(118): 'Location' is not a member of 'Schools.Table'.

Thanks
CeemaOpen the report and Do verify database

Monday, March 19, 2012

Logon Failure during exporting

Using Crystal Report for VS.Net in one of my .Net project, to connect to Oracle database "myDB" to generate a report. Things seems OK till it hits the "ExportToDisk" method, and gave me a "Logon Failure" exception.

Googled around and somebody said that I have to use "setDatabaseLogon()" method to set the uid/pass during runtime. So I did but it still didn't work.

Here's my source code, hope somebody could shed some light on this. Thanks !

******************************
"myConnection" is an estabilished OleDbConnection that was used repeatedly through the project. "dsTemp" is a dataset
******************************
Dim rptWKIT As New crWKIT()
Dim exportFileName As String = "exportedReport.rpt"
Dim exportPath As String = Application.StartupPath & "\" & exportFileName

Try
dsTemp.Clear()
Dim myDA As New OleDb.OleDbDataAdapter()
Dim myCmd As New OleDb.OleDbCommand()
myCmd.Connection = myConnection
myCmd.CommandText = "SELECT * FROM WKIT"
myCmd.CommandType = CommandType.Text
myDA.SelectCommand() = myCmd
myDA.Fill(dsTemp, "WKIT")

rptWKIT.SetDataSource(dsTemp)
rptWKIT.SetDatabaseLogon(sUser, sPass)
rptWKIT.Load()

rptWKIT.ExportToDisk(ExportFormatType.RichText, exportPath)
Catch x As Exception
MessageBox.Show(x.Message + x.Source + x.StackTrace, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End TrySee if you find asnwer here
http://support.businessobjects.com/|||Thanks. I just figured this out... after the rptWKIT.SetDataSource(dsTemp), there's no need to do the next 2 steps:

rptWKIT.SetDatabaseLogon(sUser, sPass)
rptWKIT.Load()

It can just export without any problem. But when do Load() again, guess CR is confused...|||Glad to know you sorted it out :)

Monday, March 12, 2012

Logins to the website doesnt work after DB backing up and restoring

Hi all, plz help...

I have an asp.net login control on my website;

my users are stored in a SQL DB;

The problem is when I back-up my DB from my PC and restore it to my server; the logins doesn't work anymore. I mean the user I've created on my PC can't login on the website on the internet...

Thanks a lot...

I've had this same problem. If you delete the user from the database and re-add it, it will work. Does anyone know why this happens? Is there a numeric ID the server uses for the user name?|||

Thank god someone else had the same problem; it's been so long that I'm working on it that I allways thought it only happens to me..

Yes if I delete and then re-register same user it works but I can't say to my users please re-register:))

is there any way to programmaticaly do it? or any REAL solution??

How did you handle that? I mean does it work now?

|||Wait, when you say they are stored in a sql db, do you mean they are stored in a table or they are sql logins of the database? This happened to me when I had a user with a sql login.|||Backup/Restore does not transfer the logins. You need to generate the script to create the logins and run it to set the permissions after your restore.|||

They are in a table..

I'm not talking about SQL logins. Logins are aspnetdb logins for a web site. I mean users inside the aspnetdb_Membership and aspnetdb_Users tables...

|||The users may be in a table. You still need to run a script to SET the permissions for the users.|||

What script s that?

Users (I mean the user connecting by internet) already got permissions and re-mapped?

|||

The user exists in your table but he/she does not yet have the permissions to execute any scripts.

Check out BOL for sp_addlogin, sp_grantlogin, sp_defaultdb, etc.. If you are not sure of the scripts, try generating the script for existing logins.

|||

Hi,

I think the answer is hidden somewhere over there I didn't even realised that there could be that much stored procedure and functions... Anyways I found that sp's but I didn't understand anything:) how can I work em out from a query? Also I found "dt_validateloginparams" could that also be related?

Actually theres a parameter HasAccess like below:

EXEC

%%LocalLogin(Name= @.loginame).SetAccess(HasAccess= 1)

I think this is the key line but where does it store this HasAccess info? I couldn't find it in the tables?

Thanks a lot...

|||

In Enterprise Manager, right click on the DB -> All Tasks -> Generate Scripts -> Options tab -> select "Script SQL Server Logins" -> Back to General tab -> Click on Preview.

You can either paste the code into a stored proc and call it from your application or parameterize the scripts and use it for any login...as creative as you can get...

|||

Hi;

I'm sorry; I'm as lame as I couldn't figure it out. Maybe you already told me the answer but I don't know...

Could you please tell me what to do:)

Thanks a lot..

|||I just did. Thats the best I can do.|||Ok man; thanks.. I'll try..|||http://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx

Logins and users question

Ok, let me preface my question with a little info about the application I am working on. I am in the middle of creating a project in VB.Net for my company. We have a data management system for handling sampling data. Now the database design is like so. The application is able to handle multiple "Sites". We create a new database for each site that is create dint eh application. These databases are identical in structure but the data is obviously different.

Now we don't actually delete any records in this application rather we mark items as deleted instead. This allows us to easily undo any changes that have been made to the data. When a change or delete are made, we record this change so that reports can be printed to show what changes were made and by who. This is all well and good, but my thoughts are this.

At the moment I am writing lots of VB code to handle adding these records of change and inserting them into the database... What I would like to be able to do is to just create Triggers on the tables to add them. This is something that I know how to do and i feel like it would be the better way to do it except for one thing... here comes the issue...

I have no way of knowing what user is logged in to my application from within the trigger because the application uses a single login for accessing the database. My thoughts are this... Would I be crazy to think that it would be a good idea to create SQL server logins for each user that is created in the application, giving these users access to only the database that they have been created in? This would allow me to determine who was logged in when the change was made and could then implement recording changes through triggers... I am not a very experienced dba programming is more my speciality. I know how to implement this idea, but I am just wondering if this sort of thing is considered bad practice or if it is something I should consider implementing...

Sorry for the novel there and thanks for any help or insight.

BrianNot sure if this helps but there is the suser_sname() which should return the login name (I usually put this in as the default value for my EnteredBy field and I'm not sure if it will work in your case with the single login but it may be worth investigating.)|||Well, that is what I am looking for, but I was wondering if it makes sense to create a SQL server login for each user in my application.|||Well, that is what I am looking for, but I was wondering if it makes sense to create a SQL server login for each user in my application.

It would seem so if you want to track who is inserting or modifying your data!|||We use connection pooling wih a single login to the database

The users have application security, and they log into the app via a user table, with passwrod verification done by an API to RACF

Every database call is limited to Stored Procedures

The Calling App must pass as a parameter to the sproc, the application user that is logged

Any modification that is done records the app user on the row

A trigger then moves the before image row to history as is

The last person making the modification is on the current row

Friday, March 9, 2012

Login with different Roles

Hello readers

I have a problem with the following:

I made a login page in Visual Web Developer 2005 and I used the ASP.net Configationtool in the Website menu. Made some couple test accounts to login and made a role: "Beheerders". Made 1 of my test accounts a "Administrators".

So my problem is when I log in with the account with the "Beheerders" role, i go to the page of the "normal user". I tried to look in many sites, I could find some nice aid but not 100% the one that could solve my problem.

This is my code i programmed in the seperatefile of Login.aspx

Imports System

Imports System.Data

Imports System.Data.SqlClient

Imports Login

PartialClass Login

Inherits System.Web.UI.Page

ProtectedSub Login1_LoggedIn(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Login1.LoggedIn

Dim userinfoAs MembershipUser = Membership.GetUser(Login1.UserName)

Dim UserRol()AsString

UserRol = Roles.GetRolesForUser(userinfo.UserName)

If (Roles.IsUserInRole("Beheerders") =False)Then

Response.Redirect("~\Index.aspx")

EndIf

EndSub

ProtectedSub Login1_LoggedIn()

EndSub

ProtectedSub Login1_LoginError(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Login1.LoginError

'Parameters instellen voor InvalidCredentialsLogDataSource

InvalidCredentialsLogDataSource.InsertParameters("ApplicationName").DefaultValue = Membership.ApplicationName

InvalidCredentialsLogDataSource.InsertParameters("UserName").DefaultValue = Login1.UserName

InvalidCredentialsLogDataSource.InsertParameters("IPAddress").DefaultValue = Request.UserHostAddress

InvalidCredentialsLogDataSource.InsertParameters("Password").DefaultValue = Login1.Password

'Er was een probleem bij het aanmelden

'Nakijken of gebruiker bestaat in de databank

Dim userInfoAs MembershipUser = Membership.GetUser(Login1.UserName)

If userInfoIsNothingThen

'Ongeldige gebruikersnaam...

LoginErrorDetails.Text ="Geen gebruiker met naam """ & Login1.UserName &""" in de databank !"

Else

'Nakijken of gebruiker Lockedout of Approved is

IfNot userInfo.IsApprovedThen

LoginErrorDetails.Text ="Uw account is nog niet goedgekeurd!"

ElseIf userInfo.IsLockedOutThen

LoginErrorDetails.Text ="Uw account is geblokkeerd wegens te veel mislukte aanmeldpogingen!"

Else

'Het wachtwoord was verkeerd

LoginErrorDetails.Text ="Verkeerd wachtwoord - """ & Login1.Password &""""

EndIf

EndIf

'Record wegschrijven naar datasource

InvalidCredentialsLogDataSource.Insert()

EndSub

EndClass

Thanks for your help.

Regardings

Griffin1987

I believe your problem here is that in the loggedIn event, the cookie is not actually set yet. To get the name of the user, use the name from the control which I think is

login1.UserName

Wednesday, March 7, 2012

Login to SQL Database

Hi,

I'm trying to login to SQL server for ASP .NET and I receive this message:
< Login Failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection>
I'm working on intranet and we have a web sence in the company network

When I connect from VB .NET I don't have any problem, the only problem is between SQL and ASp.NET

Any help please,

ThanksMake sure the application in IIS does not allow anonymous access, just Integrated Windows access. That is usually what has caused this problem for us.

Friday, February 24, 2012

Login process error

Hi guys
Just setup a new system running Win2k3, SQL Server 2005, etc (all msdn).
I've got a web app (.net 2) which is running perfectly well, most of the
time, and then there's one page where I'm getting the following error...
Server Error in '/' Application.
A connection was successfully established with the server, but then an error
occured during the login process. (provider: Shared Memory Provider, error:
0
- No process is on the other end of the pipe.)
I guess the question is what does this message mean and how can I fix it?!
It's a website that's working fine apart from that page, and as far as I can
tell the code should be fine. Help!!
Cheers
Danmusosdev wrote:
> Hi guys
> Just setup a new system running Win2k3, SQL Server 2005, etc (all
> msdn). I've got a web app (.net 2) which is running perfectly well,
> most of the time, and then there's one page where I'm getting the
> following error...
> Server Error in '/' Application.
> A connection was successfully established with the server, but then
> an error occured during the login process. (provider: Shared Memory
> Provider, error: 0 - No process is on the other end of the pipe.)
> I guess the question is what does this message mean and how can I fix
> it?! It's a website that's working fine apart from that page, and as
> far as I can tell the code should be fine. Help!!
> Cheers
>
> Dan
http://msdn2.microsoft.com/en-us/library/ms175496.aspx
http://blogs.msdn.com/sql_protocols.../22/483684.aspx (see
message 4)
David Gugick - SQL Server MVP
Quest Software

Login Problems using .net 2 Login Control

Hi There,

I have a really strange problem. I am creating a website with an administration back end. We have a seperate sql 2000 server which we are using hold authentication credientials (after having used the aspnet_regsql.exe to setup the appropriate tables.

When testing the application on the local machine, everything works fine. The web admin works, I can login, I can retrieve data to display on the rest of the site. Once uploaded to the live environment things change.

I can still connect to the sql server i.e. I have information being displayed on the public area of the site which is coming from the sql 2000 db. I can type in the incorrect login details to the admin section of the site and the system will return an error, which is correct as well, however, if I type in the correct login information, the page hangs for awhile and then displays this error: My question is, why is it doing this when it works find on my local box and the DB connection is actually working on other parts of the site? Can anyone help?

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Make sure TCP/IP activated as a connection method to the sql server and firewall doesn't block the connection.

|||

HI.

There is no firewall between the two servers and TCP/IP is enabled. The fact is, a connection is working elsewhere on the site, but the login just doesnt work.

|||How do you know the connection is working? Do you mean the conneciton can be established to the remote SQL 2000 instance? You can turn on Audit Login for the SQL 2000 instance (right click the instance in Enterprise Manager->check Properties->switch to Security tab->change the Audit Level to All->restart server, then if there is any login failure, you can find the login failure error message in SQL ERRORLOGs.|||

I think I have figured out what the problem is. I had the membership data source defined but not the roles, this meant that the roles were being stored in the sqlexpress DB while the membership details were being stored on SQL 2000. On my local machine, it could see both DB but when uploaded to the servers (that do not support sqlexpress DB) it was failing to connect once a successful login was taking place and roles needed to be allocated.

Pity the error reported gave no indication of what the problem really was.

Now I am having issues with creating the necessary permissions tables on the server. Once I get it all going and tested, I will clost this post as being solved.

Login problem: MSDE database from ASP.Net

I have created an MSDE database and successfully used it with an VB.Net
program on my desktop. Works great.
I have just begun learning ASP.Net. I created another MSDE database. But I
can't get past the login problems. "Predict" is the name of the database.
"GARY" is the Windows user account name. The error message is as follows:
Cannot open database requested in login 'Predict'. Login fails. Login failed
for user 'GARY\ASPNET'.
I used the following 2 connection strings. Neither works.
data source=(local)\VSdotNET;database=Predict;integrate d security=true
workstation id=GARY;packet size=4096;integrated security=SSPI;data
source="GARY\VSDOTNET";persist security info=False;initial catalog=Predict
Does anyone know what MSDE might be looking for here?
hi Gary,
Gary Frank wrote:
> I have created an MSDE database and successfully used it with an
> VB.Net program on my desktop. Works great.
> I have just begun learning ASP.Net. I created another MSDE database.
> But I can't get past the login problems. "Predict" is the name of
> the database. "GARY" is the Windows user account name. The error
> message is as follows:
> Cannot open database requested in login 'Predict'. Login fails. Login
> failed for user 'GARY\ASPNET'.
> I used the following 2 connection strings. Neither works.
> data source=(local)\VSdotNET;database=Predict;integrate d security=true
> workstation id=GARY;packet size=4096;integrated security=SSPI;data
> source="GARY\VSDOTNET";persist security info=False;initial
> catalog=Predict
> Does anyone know what MSDE might be looking for here?
you have to grant the account trying to log in (GARY\ASPNET) login
privileges as long as granting hin db access to the required databases..
as you can see from the raised error, using WinNT trusted authentication via
asp, you are not using the account you are logged in with, but the account
IIS is running on..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.14.0 - DbaMgr ver 0.59.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> wrote in message
news:3jdk15Fp8sp6U1@.individual.net...
> hi Gary,
> Gary Frank wrote:
> you have to grant the account trying to log in (GARY\ASPNET) login
> privileges as long as granting hin db access to the required databases..
> as you can see from the raised error, using WinNT trusted authentication
> via asp, you are not using the account you are logged in with, but the
> account IIS is running on..
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.14.0 - DbaMgr ver 0.59.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
Thanks Andrea. I am using MSDE and not SQL Server. As I understand it,
MSDE does not come with comprehensive administration tools. I can't figure
out how to grant access using MSDE. Are you aware of any tools I can
download or pay for without buying SQL Server, in order to grant database
access to a Windows user account?
|||hi Gary,
Gary Frank wrote:
> Thanks Andrea. I am using MSDE and not SQL Server. As I understand
> it, MSDE does not come with comprehensive administration tools. I
> can't figure out how to grant access using MSDE. Are you aware of
> any tools I can download or pay for without buying SQL Server, in
> order to grant database access to a Windows user account?
you can use the command line tool, oSql.exe, provided with MSDE, like
described in
http://support.microsoft.com/default...EN-US;q325003, or you can
have a look at a free prj of mine, available at the link following my
sign... other tools,, both free and commercial, are listed at
http://www.microsoft.com/sql/msde/partners/ and/or
http://www.aspfaq.com/show.asp?id=2442..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.14.0 - DbaMgr ver 0.59.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Monday, February 20, 2012

Login Page Using SQL DB

I apologize because this question is probably so amazingly simple it sounds retarded, but I am a 100% newbie to ASP.NET --

I am using WebMatrix to create an ASP.NET login page (coding in VB), and I have a SQL server with a table in it called "LoginInfo". That table has three fields, "PrimaryKey", "UserID" and "PIN".

Basically, the goal is that the user goes to the page and enters their UserID and PIN into two different boxes and then pushes a button and it logs them into the page. My problem is, I have the UserID/PIN text boxes, I have the button, I have the SQLDataConnection (I just dragged the table from the Database onto the page and it made it for me), but I don't know what to do at all now.

How do I have the UserID text box check against the UserID's pulled from the table in the SQL server, and how do I have the PIN numbers check against the PIN numbers pulled from the SQL table, and then if they match up let the user into the site?

I'm sorry if this is a lengthy question to answer or if it is so simple its irritating, as I said I am a complete newbie.Have you gone through theASP.NET Web Matrix Project Guided Tour? There is a section called "Build an End-to-End Application" which containsCreate Login page that should help you.

Terri|||Thanks a TON tmorton, you're the best. This is a great resource I hadn't known about. I just read the entire thing for the login page and it's excellent. I will be reading many of the other tutorials also.

Thanks a million!|||There are lots of other resources for ASP.NET Web Matrix, and here are 2 more free ones that should not be missed:

Inside ASP.NET Web Matrix, which is a .PDF file containing a free online book by Alex Homer and Dave Sussman.

The .NET Show: ASP.NET Web Matrix with Microsoft's Scott Guthrie and Nikhil Kothari.

And also, there is a forum here specifically for ASP.NET Web Matrix:view forum 30

Glad to help!

Terri

Login Page just refreshes with ASP.NET 2.0 Login Control

I am try to login using the ASP.NET 2.0 Standard Login Control. When I enter the correct userId/Password and hit the Login button, the page just refreshes, no error is displayed. But if I enter wrong userid/password..it give me an error.

Also I check the Membership.ValidateUser() returns true, that means the user is validated, but still I am able to redirect to ReturnURL.?

Is there something wrong with the Authentication, or Creating a cookie. Can somebody shed some light on this,

I have the following machine configuration

Windows XP Pro Service Pack2
IIS 5.1
SQL Server 2000
Visual Studio 2005
DISABLE ANONMYOUS ACCESS IN IIS
ENABLE WINDOWS AUTHENTICATION

I am getting the following output :

Membership.ValidateUser(Login1.UserName, Login1.Password) : - True
HttpContext.Current.User.Identity.Name : - // is blank
User.Identity.IsAuthenticated :- False
User.Identity.AuthenticationType :- // is blank

NOTE : The applicationName is same in web.config as well as in the aspnet_Applications table in SQL Server 2000 membership database.

Do you have an error logged in the SQL Server error log file (name starts with ERRORLOG)?

If not, then you should post the question on an ASP forum.

Thanks
Laurentiu

Login Page just refreshes with ASP.NET 2.0 Login Control

I am try to login using the ASP.NET 2.0 Standard Login Control. When I enter the correct userId/Password and hit the Login button, the page just refreshes, no error is displayed. But if I enter wrong userid/password..it give me an error.

Also I check the Membership.ValidateUser() returns true, that means the user is validated, but still I am able to redirect to ReturnURL.?

Is there something wrong with the Authentication, or Creating a cookie. Can somebody shed some light on this,

I have the following machine configuration

Windows XP Pro Service Pack2
IIS 5.1
SQL Server 2000
Visual Studio 2005
DISABLE ANONMYOUS ACCESS IN IIS
ENABLE WINDOWS AUTHENTICATION

I am getting the following output :

Membership.ValidateUser(Login1.UserName, Login1.Password) : - True
HttpContext.Current.User.Identity.Name : - // is blank
User.Identity.IsAuthenticated :- False
User.Identity.AuthenticationType :- // is blank

NOTE : The applicationName is same in web.config as well as in the aspnet_Applications table in SQL Server 2000 membership database.

Do you have an error logged in the SQL Server error log file (name starts with ERRORLOG)?

If not, then you should post the question on an ASP forum.

Thanks
Laurentiu