Showing posts with label connects. Show all posts
Showing posts with label connects. Show all posts

Sunday, February 12, 2012

ASP.Net dev site not running using ASPNET account?

VS2005

Hi

If I run the below code (this simply connects to SQL Server and returns the user name the connection is made under):

 Dim ConnectionAs New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("LocalSqlServer").ToString)Dim AttCommandAs New SqlCommand("SELECT System_USER", Connection) Connection.Open()Dim AttendanceReaderAs SqlDataReader = AttCommand.ExecuteReader AttendanceReader.Read() Debug.Print(AttendanceReader.Item(0).ToString)
I get:

MyDomain\pootle.flump

Which is the account I am running on the dev machine. I expected ASP.Net to run as ASPNET irrespective of the currently logged in account. Am I plain wrong? Do I need to change something in IIS? Do I need to change something in ASP.Net?

Any help greatly appreciated

Thanks

VS2005 by default uses a local web server running under your account, rather than a web site running under IIS. This is a change from VS2002/2003.

|||

Thank you

You say this is default - is there a way to change this?

|||

Hi

Does anyone know how to (or if I should be...) run the site (on dev machine) using the ASPNET account?

Thanks

ASP.NET database won't connect...

I setup a asp.net project running on http://localhost/ which connects to a
database on another server running sqlserver...
I was able to connect to the database and create my application no problem.
The sqlserver database server had windows 2000 without any SP's or updates.
This was no problem and even though the OS hadn't the .net framework
installed, everything worked fine.
the requirements for that sqlserver database server have since changed, and
windows update was visited to get all the updates, including the latest SP's
as well as the .net framework. I also installed the remote only debugging
for VS.net on this server so that I'm also able to use this as a IIS
server...
Anyway, back to my problem, since these updates the asp.net application i
run from my machine, whcih connects to this database server, has stopped
working with error "SQL Server does not exist or access denied" on the line
where the .Open() is called on the ADO.net database connection object.
Any ideas?It sounds like one of the updates tightened the security on your SQL database.
You'll want to verify that the account you are using for the data still has
sufficient rights.
Is it possible that the sa account or its password was changed?
"Daniel Bass" <danielbassNOJUNK@.MAILpostmaster.co.uk> wrote in message
news:eO9GBgBXDHA.2200@.TK2MSFTNGP09.phx.gbl...
I setup a asp.net project running on http://localhost/ which connects to a
database on another server running sqlserver...
I was able to connect to the database and create my application no problem.
The sqlserver database server had windows 2000 without any SP's or updates.
This was no problem and even though the OS hadn't the .net framework
installed, everything worked fine.
the requirements for that sqlserver database server have since changed, and
windows update was visited to get all the updates, including the latest SP's
as well as the .net framework. I also installed the remote only debugging
for VS.net on this server so that I'm also able to use this as a IIS
server...
Anyway, back to my problem, since these updates the asp.net application i
run from my machine, whcih connects to this database server, has stopped
working with error "SQL Server does not exist or access denied" on the line
where the .Open() is called on the ADO.net database connection object.
Any ideas?|||The strange thing is that when i connect to it via the server explorer it
still works, and I'm able to view tables, edit data etc etc...
If i delete my connection, recreate it and rename it, I get the same result.
If I connect to the database via classic ASP, it works fine...
I've checked the sa login but appears it's still okay.
"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:ODWGphBXDHA.652@.TK2MSFTNGP10.phx.gbl...
> It sounds like one of the updates tightened the security on your SQL
database.
> You'll want to verify that the account you are using for the data still
has
> sufficient rights.
> Is it possible that the sa account or its password was changed?
> "Daniel Bass" <danielbassNOJUNK@.MAILpostmaster.co.uk> wrote in message
> news:eO9GBgBXDHA.2200@.TK2MSFTNGP09.phx.gbl...
> I setup a asp.net project running on http://localhost/ which connects to a
> database on another server running sqlserver...
> I was able to connect to the database and create my application no
problem.
> The sqlserver database server had windows 2000 without any SP's or
updates.
> This was no problem and even though the OS hadn't the .net framework
> installed, everything worked fine.
> the requirements for that sqlserver database server have since changed,
and
> windows update was visited to get all the updates, including the latest
SP's
> as well as the .net framework. I also installed the remote only debugging
> for VS.net on this server so that I'm also able to use this as a IIS
> server...
> Anyway, back to my problem, since these updates the asp.net application i
> run from my machine, whcih connects to this database server, has stopped
> working with error "SQL Server does not exist or access denied" on the
line
> where the .Open() is called on the ADO.net database connection object.
> Any ideas?
>
>|||Daniel,
What does your connection string look like?
Benny Tordrup
"Daniel Bass" <danielbassNOJUNK@.MAILpostmaster.co.uk> skrev i en meddelelse
news:eO9GBgBXDHA.2200@.TK2MSFTNGP09.phx.gbl...
> I setup a asp.net project running on http://localhost/ which connects to a
> database on another server running sqlserver...
> I was able to connect to the database and create my application no
problem.
> The sqlserver database server had windows 2000 without any SP's or
updates.
> This was no problem and even though the OS hadn't the .net framework
> installed, everything worked fine.
> the requirements for that sqlserver database server have since changed,
and
> windows update was visited to get all the updates, including the latest
SP's
> as well as the .net framework. I also installed the remote only debugging
> for VS.net on this server so that I'm also able to use this as a IIS
> server...
> Anyway, back to my problem, since these updates the asp.net application i
> run from my machine, whcih connects to this database server, has stopped
> working with error "SQL Server does not exist or access denied" on the
line
> where the .Open() is called on the ADO.net database connection object.
> Any ideas?
>|||Does this mean i have to set up an "asp.net" account?
I've not seen any place to do this, how is it done?
thanks.
Dan
"Kevin Spencer" <kevin@.takempis.com> wrote in message
news:%23vq9tMCXDHA.2484@.TK2MSFTNGP09.phx.gbl...
> Your server explorer runs under a different account than ASP.Net.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Complex things are made up of
> lots of simple things.
> "Daniel Bass" <danielbassNOJUNK@.MAILpostmaster.co.uk> wrote in message
> news:u6frlmBXDHA.3444@.tk2msftngp13.phx.gbl...
> > The strange thing is that when i connect to it via the server explorer
it
> > still works, and I'm able to view tables, edit data etc etc...
> >
> > If i delete my connection, recreate it and rename it, I get the same
> result.
> > If I connect to the database via classic ASP, it works fine...
> >
> > I've checked the sa login but appears it's still okay.
> >
> >
> >
> > "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
> > news:ODWGphBXDHA.652@.TK2MSFTNGP10.phx.gbl...
> > > It sounds like one of the updates tightened the security on your SQL
> > database.
> > > You'll want to verify that the account you are using for the data
still
> > has
> > > sufficient rights.
> > >
> > > Is it possible that the sa account or its password was changed?
> > >
> > > "Daniel Bass" <danielbassNOJUNK@.MAILpostmaster.co.uk> wrote in message
> > > news:eO9GBgBXDHA.2200@.TK2MSFTNGP09.phx.gbl...
> > > I setup a asp.net project running on http://localhost/ which connects
to
> a
> > > database on another server running sqlserver...
> > >
> > > I was able to connect to the database and create my application no
> > problem.
> > >
> > > The sqlserver database server had windows 2000 without any SP's or
> > updates.
> > > This was no problem and even though the OS hadn't the .net framework
> > > installed, everything worked fine.
> > >
> > > the requirements for that sqlserver database server have since
changed,
> > and
> > > windows update was visited to get all the updates, including the
latest
> > SP's
> > > as well as the .net framework. I also installed the remote only
> debugging
> > > for VS.net on this server so that I'm also able to use this as a IIS
> > > server...
> > >
> > > Anyway, back to my problem, since these updates the asp.net
application
> i
> > > run from my machine, whcih connects to this database server, has
stopped
> > > working with error "SQL Server does not exist or access denied" on the
> > line
> > > where the .Open() is called on the ADO.net database connection object.
> > >
> > > Any ideas?
> > >
> > >
> > >
> >
> >
>|||Daniel,
Apply the following commands in Query Analyzer (replace <ComputerName> with
the name of the SQL Server Computer and <DatabaseName> with the name of the
database that ASP.NET needs access to:
<SQL>
Exec sp_grantlogin '<ComputerName>\ASPNET'
go
use [<DatabaseName>]
go
EXEC sp_grantdbaccess '<ComputerName>\ASPNET'
go
exec sp_addrolemember @.rolename='db_owner', @.membername='<ComputerName>\ASPNET'
go
</SQL>
Best regards,
Benny Tordrup
"Daniel Bass" <danielbassNOJUNK@.MAILpostmaster.co.uk> skrev i en meddelelse
news:uIQz4oCXDHA.2444@.tk2msftngp13.phx.gbl...
> Does this mean i have to set up an "asp.net" account?
> I've not seen any place to do this, how is it done?
> thanks.
> Dan
>
> "Kevin Spencer" <kevin@.takempis.com> wrote in message
> news:%23vq9tMCXDHA.2484@.TK2MSFTNGP09.phx.gbl...
> > Your server explorer runs under a different account than ASP.Net.
> >
> > --
> > HTH,
> >
> > Kevin Spencer
> > Microsoft MVP
> > .Net Developer
> > http://www.takempis.com
> > Complex things are made up of
> > lots of simple things.
> >
> > "Daniel Bass" <danielbassNOJUNK@.MAILpostmaster.co.uk> wrote in message
> > news:u6frlmBXDHA.3444@.tk2msftngp13.phx.gbl...
> > > The strange thing is that when i connect to it via the server explorer
> it
> > > still works, and I'm able to view tables, edit data etc etc...
> > >
> > > If i delete my connection, recreate it and rename it, I get the same
> > result.
> > > If I connect to the database via classic ASP, it works fine...
> > >
> > > I've checked the sa login but appears it's still okay.
> > >
> > >
> > >
> > > "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in
message
> > > news:ODWGphBXDHA.652@.TK2MSFTNGP10.phx.gbl...
> > > > It sounds like one of the updates tightened the security on your SQL
> > > database.
> > > > You'll want to verify that the account you are using for the data
> still
> > > has
> > > > sufficient rights.
> > > >
> > > > Is it possible that the sa account or its password was changed?
> > > >
> > > > "Daniel Bass" <danielbassNOJUNK@.MAILpostmaster.co.uk> wrote in
message
> > > > news:eO9GBgBXDHA.2200@.TK2MSFTNGP09.phx.gbl...
> > > > I setup a asp.net project running on http://localhost/ which
connects
> to
> > a
> > > > database on another server running sqlserver...
> > > >
> > > > I was able to connect to the database and create my application no
> > > problem.
> > > >
> > > > The sqlserver database server had windows 2000 without any SP's or
> > > updates.
> > > > This was no problem and even though the OS hadn't the .net framework
> > > > installed, everything worked fine.
> > > >
> > > > the requirements for that sqlserver database server have since
> changed,
> > > and
> > > > windows update was visited to get all the updates, including the
> latest
> > > SP's
> > > > as well as the .net framework. I also installed the remote only
> > debugging
> > > > for VS.net on this server so that I'm also able to use this as a IIS
> > > > server...
> > > >
> > > > Anyway, back to my problem, since these updates the asp.net
> application
> > i
> > > > run from my machine, whcih connects to this database server, has
> stopped
> > > > working with error "SQL Server does not exist or access denied" on
the
> > > line
> > > > where the .Open() is called on the ADO.net database connection
object.
> > > >
> > > > Any ideas?
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>

ASP.net app TO SQL SERVER REPORTING DATABASE.

Hi guys; hope you can help me
I have built a web app that sits on our web server (asp.net 2.0).
this connects to our SQL server (2005) reporting services database on
dataserver.
Anonymous access must be switched of on IIS (integrated windows only
on).
Once the report has been selected by the user, I query the database to
get the parameters for selected report (loop through parameters
collection). I then check the required parameter controls for the
parameter values. I was using Anonymous access and this was working
fine. But since changing to not allowing Anonymous access I get an
"The request failed with HTTP status 401: Access Denied" error when
using the GetReportParameters method. My code is below
Dim rs As New washington.ReportingService()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim report As String = strReportPath & strReportName
Dim forRendering As Boolean = False
Dim historyID As String = Nothing
Dim values As washington.ParameterValue() = Nothing
Dim credentials As washington.DataSourceCredentials() = Nothing
Dim parameters As washington.ReportParameter() = Nothing
parameters = rs.GetReportParameters(report, historyID, forRendering,
values, credentials)
Dim intParamCount As Integer = parameters.Length
Dim intLoopCounter As Integer
Dim parmArray(intParamCount - 1) As ReportParameter
If Not (parameters Is Nothing) Then
Dim rp As washington.ReportParameter
For Each rp In parameters
' loop collection
Next rp
End if
as i understand it i should be passing the credentials to the report
but when call
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
the credentials are empty
am i on the correct path
cheers
pHi, Phil
so, you're using the SOAP API to query parameters for a specific
report, and when you switch the ReportServer web app from anonymous to
Integrated Auth only, you get Access denied. Have you tried hitting
the report server URL from Internet Explorer after you switch to Integ.
Auth? Can you see the Report Server web app? Does it display any
catalog items like folders and reports? Does it display the report
you're trying to query for parameters, and if so, does it allow you to
run it from the browser?
If you answer yes, then your current user context has access to the
report server (by default the installation grants the local
administrators group full access to the report catalog from the root).
Also, when you try to "debug" or output the credentials from the
DefaultCredentials it will always have an empty value. Try deploying
your code to another server, instead of the localhost, and the
CredentialCache property should work fine. If you would still like to
test from your localhost, instead of using
CredentialCache.DefaultCredentials, try creating a new
NetworkCredential(string user, string pwd, string domain). You can
hardcode your credentials there, and test your code that way just to
test if you are actually authenticating at the server side with the web
service. Note that this option is for a test scenario, not for
production, as you would not want to bake in credentials in code.
If you answer no, then simply login to the box as a local admin account
(or open IE using the "Run As" option and enter the credentials of an
admin account on the box). Once you're logged in as admin and open IE
to the Report Manager URL (http://<machinename or localhost>/Reports),
you can view the properties of the folder or item (report) and add a
user account and permissions set for access to that catalog item ( you
can give it Content Manager, Browser, etc).
Regards,
Thiago Silva
On Nov 23, 10:59 am, "Phils" <phil.sm...@.iresponse.co.uk> wrote:
> Hi guys; hope you can help me
> I have built a web app that sits on our web server (asp.net 2.0).
> this connects to our SQL server (2005) reporting services database on
> dataserver.
> Anonymous access must be switched of on IIS (integrated windows only
> on).
> Once the report has been selected by the user, I query the database to
> get the parameters for selected report (loop through parameters
> collection). I then check the required parameter controls for the
> parameter values. I was using Anonymous access and this was working
> fine. But since changing to not allowing Anonymous access I get an
> "The request failed with HTTP status 401: Access Denied" error when
> using the GetReportParameters method. My code is below
> Dim rs As New washington.ReportingService()
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> Dim report As String = strReportPath & strReportName
> Dim forRendering As Boolean = False
> Dim historyID As String = Nothing
> Dim values As washington.ParameterValue() = Nothing
> Dim credentials As washington.DataSourceCredentials() = Nothing
> Dim parameters As washington.ReportParameter() = Nothing
> parameters = rs.GetReportParameters(report, historyID, forRendering,
> values, credentials)
> Dim intParamCount As Integer = parameters.Length
> Dim intLoopCounter As Integer
> Dim parmArray(intParamCount - 1) As ReportParameter
> If Not (parameters Is Nothing) Then
> Dim rp As washington.ReportParameter
> For Each rp In parameters
> ' loop collection
> Next rp
> End if
> as i understand it i should be passing the credentials to the report
> but when call
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> the credentials are empty
> am i on the correct path
> cheers
> p|||Once you make the site non-anonymous, the credentials are no longer
anonymous. You have to actually query the user. I did this a few months ago
at another job, but do not have access to the code. I remember experimenting
with impersonation and believe that was the first part of the solution.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
********************************************
Think outside the box!
********************************************
"Phils" <phil.smith@.iresponse.co.uk> wrote in message
news:1164301180.467523.79980@.k70g2000cwa.googlegroups.com...
> Hi guys; hope you can help me
>
> I have built a web app that sits on our web server (asp.net 2.0).
> this connects to our SQL server (2005) reporting services database on
> dataserver.
> Anonymous access must be switched of on IIS (integrated windows only
> on).
>
> Once the report has been selected by the user, I query the database to
> get the parameters for selected report (loop through parameters
> collection). I then check the required parameter controls for the
> parameter values. I was using Anonymous access and this was working
> fine. But since changing to not allowing Anonymous access I get an
> "The request failed with HTTP status 401: Access Denied" error when
> using the GetReportParameters method. My code is below
>
> Dim rs As New washington.ReportingService()
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials
>
> Dim report As String = strReportPath & strReportName
> Dim forRendering As Boolean = False
> Dim historyID As String = Nothing
> Dim values As washington.ParameterValue() = Nothing
> Dim credentials As washington.DataSourceCredentials() = Nothing
> Dim parameters As washington.ReportParameter() = Nothing
>
> parameters = rs.GetReportParameters(report, historyID, forRendering,
> values, credentials)
>
> Dim intParamCount As Integer = parameters.Length
> Dim intLoopCounter As Integer
> Dim parmArray(intParamCount - 1) As ReportParameter
> If Not (parameters Is Nothing) Then
> Dim rp As washington.ReportParameter
> For Each rp In parameters
> ' loop collection
>
> Next rp
> End if
>
> as i understand it i should be passing the credentials to the report
> but when call
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials
>
> the credentials are empty
> am i on the correct path
> cheers
> p
>

ASP.NET and SQL Server

Hello.
I have an asp.net application which currently connects to a local instance
of sql server without any issue.
When I connect to a remote sql server (same database and userid and password
are valid) there is an error indicating 'access denied.' But, when the same
code and connection strings are run on the remote server (along with the
database) the application works fine.
Connection String
user id=UserName;password=password,data source=datasource;initial
catalog=dbName
datasource\ASPNET has been added to the sql server as a user.
Any ideas? I'm using SQL Authentication and ASP.NET 1.1
Does ASP.NET run under another account when accessing a remote server?
Thanks.a) look up SetSpn
b) look up 'trust for delegation'
I bitched up a storm about this at microsoft; they don't publish this
information anywhere.
it pissed me off sooooo bad.
it's like some secret squirrel functionality in Active Directory.
-Aaron
mojo wrote:
> Hello.
> I have an asp.net application which currently connects to a local instance
> of sql server without any issue.
> When I connect to a remote sql server (same database and userid and passwo
rd
> are valid) there is an error indicating 'access denied.' But, when the sam
e
> code and connection strings are run on the remote server (along with the
> database) the application works fine.
> Connection String
> user id=UserName;password=password,data source=datasource;initial
> catalog=dbName
> datasource\ASPNET has been added to the sql server as a user.
> Any ideas? I'm using SQL Authentication and ASP.NET 1.1
> Does ASP.NET run under another account when accessing a remote server?
> Thanks.|||Since you use Username/Password pair (meaning the SQL Server's
authentication mode is mixed mode), it does not matter if you add
MachineName\ASPNET user account as a login/user to the SQL Server/database.
The other posted reply also make no sense to your problem.
Which version of QL Server do you use? SQL Server2000 or 2005? I'd look into
two things:
1. Is remote access to the SQL Server enabled? by default installation
(especially if it is SQL Server2005/Express), remote access is disabled. You
nned to explicitly enable remote access to it;
2. Double-check to make sure the SQL Server's authentication mode is mixed
mode. Again. by default installation, SQL Server uses Windows Authentication
mode (If your app indeed worked on the same computer as the SQL Server, with
the given user name and password in connectionString, then you do not need
make this check, unless the remote SQL Server is not the same SQL Server you
have tested on the same computer).
"mojo" <mojo@.discussions.microsoft.com> wrote in message
news:52A09F8F-BC9B-4DFE-B004-3D406F0B5760@.microsoft.com...
> Hello.
> I have an asp.net application which currently connects to a local instance
> of sql server without any issue.
> When I connect to a remote sql server (same database and userid and
> password
> are valid) there is an error indicating 'access denied.' But, when the
> same
> code and connection strings are run on the remote server (along with the
> database) the application works fine.
> Connection String
> user id=UserName;password=password,data source=datasource;initial
> catalog=dbName
> datasource\ASPNET has been added to the sql server as a user.
> Any ideas? I'm using SQL Authentication and ASP.NET 1.1
> Does ASP.NET run under another account when accessing a remote server?
> Thanks.
>|||Hello,
Yes, I did double check that and it is in mixed mode. I'm running SQL Server
2000 on Windows XP & ASP.NET 1.1.
Regarding remote access, where is that in SQL 2000? I don't believe I've ran
into that setting before. Do you mind pointing me in the direction of where
I
can find it?
Thanks
"Norman Yuan" wrote:

> Since you use Username/Password pair (meaning the SQL Server's
> authentication mode is mixed mode), it does not matter if you add
> MachineName\ASPNET user account as a login/user to the SQL Server/database
.
> The other posted reply also make no sense to your problem.
> Which version of QL Server do you use? SQL Server2000 or 2005? I'd look in
to
> two things:
> 1. Is remote access to the SQL Server enabled? by default installation
> (especially if it is SQL Server2005/Express), remote access is disabled. Y
ou
> nned to explicitly enable remote access to it;
> 2. Double-check to make sure the SQL Server's authentication mode is mixed
> mode. Again. by default installation, SQL Server uses Windows Authenticati
on
> mode (If your app indeed worked on the same computer as the SQL Server, wi
th
> the given user name and password in connectionString, then you do not need
> make this check, unless the remote SQL Server is not the same SQL Server y
ou
> have tested on the same computer).
> "mojo" <mojo@.discussions.microsoft.com> wrote in message
> news:52A09F8F-BC9B-4DFE-B004-3D406F0B5760@.microsoft.com...
>
>|||check
sp_configure sysytem stored procedure.
I think it might require a restart for the changes to take effect.
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/|||ok, I checked Remote Access and it was already set to true.
Any ideas if this issue is related to version of install (Personal v
Standard v Enterprise Edition)?
"Omnibuzz" wrote:

> check
> sp_configure sysytem stored procedure.
> I think it might require a restart for the changes to take effect.
> -Omnibuzz (The SQL GC)
> http://omnibuzz-sql.blogspot.com/
>|||Can you connect to the said SQL Server from other computers at all (you can
try to access the SQL Server from other computer by creating ODBC data
source on these computers, or create a data link file (blank text file with
extension *.udl).
If you can, then it is the problem of your ASP.NET app (assume the network
cable/hub... hardware are OK. Have you checked them?), if you cannot, it is
the problem of the SQL Server configuration.
"mojo" <mojo@.discussions.microsoft.com> wrote in message
news:D4B879EE-7CBE-4A7F-B0AD-C10DDE16685D@.microsoft.com...
> Hello,
> Yes, I did double check that and it is in mixed mode. I'm running SQL
> Server
> 2000 on Windows XP & ASP.NET 1.1.
> Regarding remote access, where is that in SQL 2000? I don't believe I've
> ran
> into that setting before. Do you mind pointing me in the direction of
> where I
> can find it?
> Thanks
> "Norman Yuan" wrote:
>