Showing posts with label deadline. Show all posts
Showing posts with label deadline. Show all posts

Monday, March 12, 2012

HELP ! Login failed for user MachineName\ASPNET

Hi,

I am new to ASP.NET and have an ever approaching deadline to develop a database driven web application. Having read a lot of articles on the Internet I decided on Visual Studio 2003, MSSQL Server 2000 Developer Edition, all running off Windowns XP Pro.

I cannot get the ASP to access the database, I keep getting the following message

System.Data.SqlClient.SqlException: Login failed for user 'MachineName\ASPNET'

I do not know what to do to sort this problem and I cannot test anything I have developed as a result. I am very desperate for help as I have been trying to sort this out for the last 5 days.

Somebody please please please help me!!!!!!!!!

Thank you if you can.

RW#1
install Connector/ODBC - MySQL ODBC driver
http://dev.mysql.com/downloads/

#2
check out Connector/ODBC Programmer's Reference Manual
http://www.mysql.com/search/?q=myodbc

#3
Here is my code to populate a datagrid from a mySQL database.

IN GLOBAL.ASAX
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
'Create Database Connection String
Dim globalConnStr As String
globalConnStr = "driver={MySQL ODBC 3.51 Driver};"
globalConnStr = globalConnStr + "server=localhost;"
globalConnStr = globalConnStr + "port=3306;"
globalConnStr = globalConnStr + "Stmt=;"
globalConnStr = globalConnStr + "uid=root;"
globalConnStr = globalConnStr + "pwd=;"
globalConnStr = globalConnStr + "database=smfr_wildland;"
globalConnStr = globalConnStr + "Option=3;"

'Assign Database Connection String To
'global connection object
Application("globalConnStr") = globalConnStr
End Sub

in your code behind page that contains a datagrid...It should look KINDA like this.

Dim strSQL As New System.Text.StringBuilder
strSQL.Append("SELECT users.*,smfr_shifts.shift_name")
strSQL.Append(" FROM users")
strSQL.Append(" INNER JOIN smfr_shifts ON users.user_shift_id = smfr_shifts.shift_id")
strSQL.Append(" WHERE users.user_deploymentYN = " & x)
strSQL.Append(" ORDER BY users.user_deploymentYN DESC , users.user_sort;")

Dim DBConn As System.Data.Odbc.OdbcConnection
Dim DBCommand As System.Data.Odbc.OdbcDataAdapter

Dim DSPageData As New DataSet
DBConn = New System.Data.Odbc.OdbcConnection(Application.Item("globalConnStr"))
DBCommand = New System.Data.Odbc.OdbcDataAdapter(strSQL.ToString, DBConn)

DBCommand.Fill(DSPageData, "users")

dgTeam.DataSource = DSPageData.Tables("users").DefaultView

dgTeam.DataBind()

'Close and Clean-Up
DBConn.Close()
DBConn.Dispose()
DBConn = Nothing

DBCommand.Dispose()
DBCommand = Nothing

DSPageData.Dispose()
DSPageData.Clear()
DSPageData = Nothing

-------
NO System.Data.SqlClient
USE System.Data.Odbc

Hope this helps?

Tom|||Ralph,

If you are indeed using Microsoft SQL Server, then your code should be OK. You've posted in the MySQL section.

What you need to do is add the MACHINENAME\ASPNET user as a Login in your database, and give that user rights to the database objects it needs.

When an ASP.NET application trys to access your SQL Server database, it does so by using that account.

[now moved from MySQL forum to SQL Server forum]|||A few important remarks:
1. ASPNET will only work on W2K and Windows XP, not on Windows Server 2003 where the identity of the application pool will be used instead (network service account).
2. Even if yo'ure on W2K, the ASPNET user can be bypassed if you're using (Windows authentication with) impersonation or you've changed the processModel section; in that case, use that user account on SQL Server instead to give permissions to.
3. However, a big fat remark: if you grant ASPNET or NETWORK SERVICE rights to the database, every other service/application running in that identity's context will have rights on the database as well. On a hosted environment where others can upload code to the machine as well, this is a big big security leak since others can write code to mess up your database. If you still need to do this, consider to give the user only read rights on the database!
4. It would be better from this side of the picture to use SQL authentication instead, although the password is not encrypted then when it's sent to the server. This is a less "heavy" issue if SQL Server is running on the same box as the web server (definitely not a scalable solution, but still it's out there in many places) or when the server environment is heavy controlled (a switched network between the servers).
5. Another approach is to impersonate as a certain identity from within the code whenever you want to talk to the database and to undo that impersonation afterward, as shown on my blog intip 7.

In any case, try to lock down the number of users that can access the database as much as you can by creating separate users on the level of the database for each database (which has only rights on that database). Never ever connect in a lazy way (e.g. using a sysadmin user).|||I did not read the posting close enough...it was in the mySQL group when I read it and replied.

MONITOR...you may delete/remove my two post for this discussion...SORRY

Tom|||Put this into a text file called grantpermission.sql. Change the 'MachineName\ASPNET' to your computer name and change Use dbname to your database name. Then use SQL Query Analyzer and execute the code to add the user and grant permissions. ASPNET will become owner as you can see in the code. This assumes that you have everything installed correctly. I have the almost the exact same setup. Although I'm also using WebMatrix. SQL Desktop Edition on Win XP Pro.

-- Begin --
DECLARE @.username sysname
SELECT @.username = 'MachineName\ASPNET'

USE master
EXEC sp_grantlogin @.username

USE dbname
EXEC sp_grantdbaccess @.username
EXEC sp_addrolemember N'db_owner', @.username
-- End --

Friday, February 24, 2012

HELP - Absurd project on a deadline!

Hi,
Someone from our headquarters wants a report of how many customers per
"Metropolitation Statistical Area" (MSA) we have in our database. See
http://www.census.gov/population/estimates/metro_general/List4.txt for
the complete list of MSA's.
Problem is, each MSA only lists one, two or three cites per area. For
example, "Boston-Cambridge-Quincy". Which leaves out EVERY other city
in that area, such as Roxbury, etc. (However, these four cities all
fall into zip codes either starting with 021 or 022).
So, doing a search by MSA city is impossible. It would miss a lot of
customers whose cities aren't listed in a given MSA, for example,
Roxbury.
Alternatively, I could use the first few digits of the zip codes. For
example, Boston zip codes start with 021 or 022. That would capture all
other cities within that area, I am thinking, or close enough.
However, the MSA website does not have any zip codes listed.
And futhermore, I am the one who has to find these zip codes... seems
like it's going to be very aggravating, long day having to look up
these zip codes.
Please, please please someone tell me there is a listing of zip codes
per MSA... or has ANYONE had to do a similar project - and can give me
some advice?
THANKS
A quick GOOGLE with the words MSA ZIP turned up commercial databases
of zip data that includes the MSA code. The price for the one I
looked at was something like $80, and it is a download so you can
don't have to wait. I know nothing other than that I found it just
now, but $80 seems pretty reasonable. The link to the page I found,
to which I have no connection, is
http://www.zip-codes.com/zip-code-database.asp
Roy Harvey
Beacon Falls, CT
On 13 Dec 2006 11:53:10 -0800, tootsuite@.gmail.com wrote:

>Hi,
>Someone from our headquarters wants a report of how many customers per
>"Metropolitation Statistical Area" (MSA) we have in our database. See
>http://www.census.gov/population/estimates/metro_general/List4.txt for
>the complete list of MSA's.
>Problem is, each MSA only lists one, two or three cites per area. For
>example, "Boston-Cambridge-Quincy". Which leaves out EVERY other city
>in that area, such as Roxbury, etc. (However, these four cities all
>fall into zip codes either starting with 021 or 022).
>So, doing a search by MSA city is impossible. It would miss a lot of
>customers whose cities aren't listed in a given MSA, for example,
>Roxbury.
>Alternatively, I could use the first few digits of the zip codes. For
>example, Boston zip codes start with 021 or 022. That would capture all
>other cities within that area, I am thinking, or close enough.
>However, the MSA website does not have any zip codes listed.
>And futhermore, I am the one who has to find these zip codes... seems
>like it's going to be very aggravating, long day having to look up
>these zip codes.
>Please, please please someone tell me there is a listing of zip codes
>per MSA... or has ANYONE had to do a similar project - and can give me
>some advice?
>THANKS
|||> And futhermore, I am the one who has to find these zip codes...
No you don't, as long as you have the ability to spend money on software
and/or a database that does it for you.
We're using one of MaxMind's databases for exactly this purpose: mapping
DMAs to zip codes and then reporting aggregates under each DMA. They have
free versions of the database too (just not as current / complete) and I
think they support web service calls for some of it too (but our volume
couldn't be supported by that).
It sounds like you need MSA and not DMA, though I confess I am not clear on
the differences. So, assuming DMA is not appropriate, some other
alternatives, some of which are free:
http://www.zipdatafiles.com/data/
http://www.zipinfo.com/products/products.htm
http://www.zipcodeworld.com/zipcodepremium.htm
http://www.freedownloadmanager.org/downloads/latitude_longitude_software/
http://www.softjamboree.com/article/zip-code-database.html
http://www.zip-codes.com/zip-code-database.asp
One of these will hopefully meet your requirements and budget.
A
|||You could also determine approximate ZIP code to MSA mappings using the U.S.
Census Bureau's free Tiger database online. Although the ZIP codes in the
Tiger database are actually "ZIP Code Tabulation Areas" and not true ZIP
codes. This inaccuracy and the amount of work involved in downloading and
cleaning up the data would make me recommend buying a commercial product.

HELP - Absurd project on a deadline!

Hi,
Someone from our headquarters wants a report of how many customers per
"Metropolitation Statistical Area" (MSA) we have in our database. See
http://www.census.gov/population/estimates/metro_general/List4.txt for
the complete list of MSA's.
Problem is, each MSA only lists one, two or three cites per area. For
example, "Boston-Cambridge-Quincy". Which leaves out EVERY other city
in that area, such as Roxbury, etc. (However, these four cities all
fall into zip codes either starting with 021 or 022).
So, doing a search by MSA city is impossible. It would miss a lot of
customers whose cities aren't listed in a given MSA, for example,
Roxbury.
Alternatively, I could use the first few digits of the zip codes. For
example, Boston zip codes start with 021 or 022. That would capture all
other cities within that area, I am thinking, or close enough.
However, the MSA website does not have any zip codes listed.
And futhermore, I am the one who has to find these zip codes... seems
like it's going to be very aggravating, long day having to look up
these zip codes.
Please, please please someone tell me there is a listing of zip codes
per MSA... or has ANYONE had to do a similar project - and can give me
some advice?
THANKSA quick GOOGLE with the words MSA ZIP turned up commercial databases
of zip data that includes the MSA code. The price for the one I
looked at was something like $80, and it is a download so you can
don't have to wait. I know nothing other than that I found it just
now, but $80 seems pretty reasonable. The link to the page I found,
to which I have no connection, is
http://www.zip-codes.com/zip-code-database.asp
Roy Harvey
Beacon Falls, CT
On 13 Dec 2006 11:53:10 -0800, tootsuite@.gmail.com wrote:
>Hi,
>Someone from our headquarters wants a report of how many customers per
>"Metropolitation Statistical Area" (MSA) we have in our database. See
>http://www.census.gov/population/estimates/metro_general/List4.txt for
>the complete list of MSA's.
>Problem is, each MSA only lists one, two or three cites per area. For
>example, "Boston-Cambridge-Quincy". Which leaves out EVERY other city
>in that area, such as Roxbury, etc. (However, these four cities all
>fall into zip codes either starting with 021 or 022).
>So, doing a search by MSA city is impossible. It would miss a lot of
>customers whose cities aren't listed in a given MSA, for example,
>Roxbury.
>Alternatively, I could use the first few digits of the zip codes. For
>example, Boston zip codes start with 021 or 022. That would capture all
>other cities within that area, I am thinking, or close enough.
>However, the MSA website does not have any zip codes listed.
>And futhermore, I am the one who has to find these zip codes... seems
>like it's going to be very aggravating, long day having to look up
>these zip codes.
>Please, please please someone tell me there is a listing of zip codes
>per MSA... or has ANYONE had to do a similar project - and can give me
>some advice?
>THANKS|||> And futhermore, I am the one who has to find these zip codes...
No you don't, as long as you have the ability to spend money on software
and/or a database that does it for you.
We're using one of MaxMind's databases for exactly this purpose: mapping
DMAs to zip codes and then reporting aggregates under each DMA. They have
free versions of the database too (just not as current / complete) and I
think they support web service calls for some of it too (but our volume
couldn't be supported by that).
It sounds like you need MSA and not DMA, though I confess I am not clear on
the differences. So, assuming DMA is not appropriate, some other
alternatives, some of which are free:
http://www.zipdatafiles.com/data/
http://www.zipinfo.com/products/products.htm
http://www.zipcodeworld.com/zipcodepremium.htm
http://www.freedownloadmanager.org/downloads/latitude_longitude_software/
http://www.softjamboree.com/article/zip-code-database.html
http://www.zip-codes.com/zip-code-database.asp
One of these will hopefully meet your requirements and budget.
A|||You could also determine approximate ZIP code to MSA mappings using the U.S.
Census Bureau's free Tiger database online. Although the ZIP codes in the
Tiger database are actually "ZIP Code Tabulation Areas" and not true ZIP
codes. This inaccuracy and the amount of work involved in downloading and
cleaning up the data would make me recommend buying a commercial product.

HELP - Absurd project on a deadline!

Hi,
Someone from our headquarters wants a report of how many customers per
"Metropolitation Statistical Area" (MSA) we have in our database. See
http://www.census.gov/population/es...neral/List4.txt for
the complete list of MSA's.
Problem is, each MSA only lists one, two or three cites per area. For
example, "Boston-Cambridge-Quincy". Which leaves out EVERY other city
in that area, such as Roxbury, etc. (However, these four cities all
fall into zip codes either starting with 021 or 022).
So, doing a search by MSA city is impossible. It would miss a lot of
customers whose cities aren't listed in a given MSA, for example,
Roxbury.
Alternatively, I could use the first few digits of the zip codes. For
example, Boston zip codes start with 021 or 022. That would capture all
other cities within that area, I am thinking, or close enough.
However, the MSA website does not have any zip codes listed.
And futhermore, I am the one who has to find these zip codes... seems
like it's going to be very aggravating, long day having to look up
these zip codes.
Please, please please someone tell me there is a listing of zip codes
per MSA... or has ANYONE had to do a similar project - and can give me
some advice?
THANKSA quick GOOGLE with the words MSA ZIP turned up commercial databases
of zip data that includes the MSA code. The price for the one I
looked at was something like $80, and it is a download so you can
don't have to wait. I know nothing other than that I found it just
now, but $80 seems pretty reasonable. The link to the page I found,
to which I have no connection, is
http://www.zip-codes.com/zip-code-database.asp
Roy Harvey
Beacon Falls, CT
On 13 Dec 2006 11:53:10 -0800, tootsuite@.gmail.com wrote:

>Hi,
>Someone from our headquarters wants a report of how many customers per
>"Metropolitation Statistical Area" (MSA) we have in our database. See
>http://www.census.gov/population/es...neral/List4.txt for
>the complete list of MSA's.
>Problem is, each MSA only lists one, two or three cites per area. For
>example, "Boston-Cambridge-Quincy". Which leaves out EVERY other city
>in that area, such as Roxbury, etc. (However, these four cities all
>fall into zip codes either starting with 021 or 022).
>So, doing a search by MSA city is impossible. It would miss a lot of
>customers whose cities aren't listed in a given MSA, for example,
>Roxbury.
>Alternatively, I could use the first few digits of the zip codes. For
>example, Boston zip codes start with 021 or 022. That would capture all
>other cities within that area, I am thinking, or close enough.
>However, the MSA website does not have any zip codes listed.
>And futhermore, I am the one who has to find these zip codes... seems
>like it's going to be very aggravating, long day having to look up
>these zip codes.
>Please, please please someone tell me there is a listing of zip codes
>per MSA... or has ANYONE had to do a similar project - and can give me
>some advice?
>THANKS|||> And futhermore, I am the one who has to find these zip codes...
No you don't, as long as you have the ability to spend money on software
and/or a database that does it for you.
We're using one of MaxMind's databases for exactly this purpose: mapping
DMAs to zip codes and then reporting aggregates under each DMA. They have
free versions of the database too (just not as current / complete) and I
think they support web service calls for some of it too (but our volume
couldn't be supported by that).
It sounds like you need MSA and not DMA, though I confess I am not clear on
the differences. So, assuming DMA is not appropriate, some other
alternatives, some of which are free:
http://www.zipdatafiles.com/data/
http://www.zipinfo.com/products/products.htm
http://www.zipcodeworld.com/zipcodepremium.htm
http://www.freedownloadmanager.org/...itude_software/
http://www.softjamboree.com/article...e-database.html
http://www.zip-codes.com/zip-code-database.asp
One of these will hopefully meet your requirements and budget.
A|||You could also determine approximate ZIP code to MSA mappings using the U.S.
Census Bureau's free Tiger database online. Although the ZIP codes in the
Tiger database are actually "ZIP Code Tabulation Areas" and not true ZIP
codes. This inaccuracy and the amount of work involved in downloading and
cleaning up the data would make me recommend buying a commercial product.