Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Wednesday, March 28, 2012

Images in SQL Database

Am building ASP.NET application and using sql 2000 server for data store. I
intend to store images in the sql server but am wondering is this a good
choice or not. I have a choice of storing them on the file system but which
is better.
The application is for a school assessment system and the images will be for
the students thus the number will grow overtime. I need to deploy the more
robust and effecient mechanism so please someone advice me....
Thanks alot in advance
You may find this article useful:
http://www.aspfaq.com/show.asp?id=2149
David Portas
SQL Server MVP

Images in SQL Database

Am building ASP.NET application and using sql 2000 server for data store. I
intend to store images in the sql server but am wondering is this a good
choice or not. I have a choice of storing them on the file system but which
is better.
The application is for a school assessment system and the images will be for
the students thus the number will grow overtime. I need to deploy the more
robust and effecient mechanism so please someone advice me....
Thanks alot in advanceYou may find this article useful:
http://www.aspfaq.com/show.asp?id=2149
David Portas
SQL Server MVP
--sql

Images in SQL Database

Am building ASP.NET application and using sql 2000 server for data store. I
intend to store images in the sql server but am wondering is this a good
choice or not. I have a choice of storing them on the file system but which
is better.
The application is for a school assessment system and the images will be for
the students thus the number will grow overtime. I need to deploy the more
robust and effecient mechanism so please someone advice me....
Thanks alot in advanceYou may find this article useful:
http://www.aspfaq.com/show.asp?id=2149
--
David Portas
SQL Server MVP
--

Wednesday, March 21, 2012

Image From DB - There but not there

Tribe,
I'm struggling with the poorly implemented image handling in SSRS
(which is represented through ASP.NET via
Microsoft.Reporting.WebForms)
First off, SSRS/Reporting team - External Images should mean exactly
that. The report should express EXACTLY what I enter into the Value
field for an External type image in a report. The fact that the engine
interprets and munges this field is an utter travesty. If I enter "/
myDBImageDumper.aspx" this text is what should be expressed out
through the Web report viewer. Period. The use of this property
"UnattendedExecutionAccount" in order to allow the report engine to
render local images is a complete and total hack
Now, in dealing with a simple database supplied image in the reporting
body of a report, I've got an Image type field in a SQLExpress table.
I've loaded this field through a web FileUpload and stored the bytes
in the field. I can render these bytes out through a web page by using
the Response.WriteBinary(reader[IMAGEFIELDPOS]);
I mention this as I know that the image now in the database in the
correct mime format (jpeg).
So, back to the report. I've added an image field to the body of the
report (I want it in the header by alas that is also an
impossibility). To this field I've assigned the mime type "image/
jpeg", the Source of Database, and a Value of:
=System.Convert.ToBase64String(Fields!UserCompanyImage.Value,
"InvoiceHeader_InvoiceHeader")
And of course the image does not render.
Adding that same value to a text field however allows the Base64 to
get dumped out in to that field. Which proves the data is there.
However, I'm baffled as to how to get this image to show up.
Clues anyone
DCTribe,
I lied. I can get the image to show up in the body of the report by
using just the straight byte dump:
=First(Fields!UserCompanyImage.Value, "InvoiceHeader_InvoiceHeader")
But what I'm really trying to do is to get the image up in the header.
So I've got another identical image up in the header and I've got its
Value set to :
=Reportitems!imageLogo.Value
Where imageLogo is the name of the first, body of the report, image.
The header image does not render.
Clues 2?
DC
On Oct 8, 2:44 pm, bangeye <davecl...@.gmail.com> wrote:
> Tribe,
> I'm struggling with the poorly implemented image handling in SSRS
> (which is represented through ASP.NET via
> Microsoft.Reporting.WebForms)
> First off, SSRS/Reporting team - External Images should mean exactly
> that. The report should express EXACTLY what I enter into the Value
> field for an External type image in a report. The fact that the engine
> interprets and munges this field is an utter travesty. If I enter "/
> myDBImageDumper.aspx" this text is what should be expressed out
> through the Web report viewer. Period. The use of this property
> "UnattendedExecutionAccount" in order to allow the report engine to
> render local images is a complete and total hack
> Now, in dealing with a simple database supplied image in the reporting
> body of a report, I've got an Image type field in a SQLExpress table.
> I've loaded this field through a web FileUpload and stored the bytes
> in the field. I can render these bytes out through a web page by using
> the Response.WriteBinary(reader[IMAGEFIELDPOS]);
> I mention this as I know that the image now in the database in the
> correct mime format (jpeg).
> So, back to the report. I've added an image field to the body of the
> report (I want it in the header by alas that is also an
> impossibility). To this field I've assigned the mime type "image/
> jpeg", the Source of Database, and a Value of:
> =System.Convert.ToBase64String(Fields!UserCompanyImage.Value,
> "InvoiceHeader_InvoiceHeader")
> And of course the image does not render.
> Adding that same value to a text field however allows the Base64 to
> get dumped out in to that field. Which proves the data is there.
> However, I'm baffled as to how to get this image to show up.
> Clues anyone
> DC|||Tribe,
Here's the trick (what a mess)
In order to get a dynamic JPEG image out of your database and into the
header of your report you must:
Add a textfield to the body of your report.
Assign the value of that textfield (call this text field
txtImageData):
= Convert.ToBase64String(Fields!MyImageStreamField)
Add an image type to your report header.
Assign the Mime type to image/jpeg and the Source to Database
Assign the value to :
= Convert.FromBase64String(ReportItems!txtImageData.Value)
Your image will then have the byte data that was originally in your
image column in your database table.
DC
On Oct 8, 3:04 pm, bangeye <davecl...@.gmail.com> wrote:
> Tribe,
> I lied. I can get the image to show up in the body of the report by
> using just the straight byte dump:
> =First(Fields!UserCompanyImage.Value, "InvoiceHeader_InvoiceHeader")
> But what I'm really trying to do is to get the image up in the header.
> So I've got another identical image up in the header and I've got its
> Value set to :
> =Reportitems!imageLogo.Value
> Where imageLogo is the name of the first, body of the report, image.
> The header image does not render.
> Clues 2?
> DC
> On Oct 8, 2:44 pm, bangeye <davecl...@.gmail.com> wrote:
> > Tribe,
> > I'm struggling with the poorly implemented image handling in SSRS
> > (which is represented through ASP.NET via
> > Microsoft.Reporting.WebForms)
> > First off, SSRS/Reporting team - External Images should mean exactly
> > that. The report should express EXACTLY what I enter into the Value
> > field for an External type image in a report. The fact that the engine
> > interprets and munges this field is an utter travesty. If I enter "/
> > myDBImageDumper.aspx" this text is what should be expressed out
> > through the Web report viewer. Period. The use of this property
> > "UnattendedExecutionAccount" in order to allow the report engine to
> > render local images is a complete and total hack
> > Now, in dealing with a simple database supplied image in the reporting
> > body of a report, I've got an Image type field in a SQLExpress table.
> > I've loaded this field through a web FileUpload and stored the bytes
> > in the field. I can render these bytes out through a web page by using
> > the Response.WriteBinary(reader[IMAGEFIELDPOS]);
> > I mention this as I know that the image now in the database in the
> > correct mime format (jpeg).
> > So, back to the report. I've added an image field to the body of the
> > report (I want it in the header by alas that is also an
> > impossibility). To this field I've assigned the mime type "image/
> > jpeg", the Source of Database, and a Value of:
> > =System.Convert.ToBase64String(Fields!UserCompanyImage.Value,
> > "InvoiceHeader_InvoiceHeader")
> > And of course the image does not render.
> > Adding that same value to a text field however allows the Base64 to
> > get dumped out in to that field. Which proves the data is there.
> > However, I'm baffled as to how to get this image to show up.
> > Clues anyone
> > DC

image datatype

Is the Image Datatype to store pictures and if so how would you transfer a picture in asp.net into a sqldatabase that has this datatype?

if it isnt for pictures what is it used for?the image datatype can be used for any binary files. Not just images.

Check out microsoft's 23 C# samples. One of them does exactly what you want!

http://msdn.microsoft.com/vcsharp/downloads/samples/23samples/default.aspx|||it doesnt work:(
i tried to download it and it said it could not perform my requestsql

Monday, March 19, 2012

Im not able to connect to SQL server using ASP.NET & VS.NET

plzz help me ,
I use VS.NET --> VB.NET --> ASP.NET appln.

Database : Nortwind using SQL data adapter

And plzz let me know what are steps in connecting to database.

I've tried something but i'm getting " Login failed for user 'HOME-HG0B8FTI7Y\ASPNET'. "
error.

Some1 out dere solve this problem

Server Error in '/WebApplication6' Application.
------------------------

Login failed for user 'HOME-HG0B8FTI7Y\ASPNET'.
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: Login failed for user 'HOME-HG0B8FTI7Y\ASPNET'.

Source Error:

Line 89: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 90: 'Put user code to initialize the page here
Line 91: Me.SqlDataAdapter1.Fill(Me.DataSet11.Categories)
Line 92: Me.DataBind()
Line 93: End Sub

Source File: d:\inetpub\wwwroot\WebApplication6\WebForm1.aspx.vb Line: 91

Stack Trace:

[SqlException: Login failed for user 'HOME-HG0B8FTI7Y\ASPNET'.]
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
System.Data.Common.DbDataAdapter.Fill(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
WebApplication6.WebForm1.Page_Load(Object sender, EventArgs e) in d:\inetpub\wwwroot\WebApplication6\WebForm1.aspx.vb:91
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()Hi there,

This happens when asp.net user account doesn't have enough permissions to access the specified database. Try thislink

Hope this helps|||It is eating my brain. U gave right solution|||Glad it worked for you...

Have fun programming..:)

Monday, March 12, 2012

I'm confused with the non-unicode

I was confused with the non-unicode when i insert chinese characters in
a varchar field using asp page, it accepted the characters and
displayed correctly. It is good for me, but i was wondering what
exactly non-unicode is and why acting like that way(I expected to
receive strange characters in the feedback asp page but i didn't). Can
anyone tell me the reason?What is the collation of the column in the table? Also, did you try
comparing two columns with that data?
MC
"jane" <bidepan@.msn.com> wrote in message
news:1167926378.282209.127980@.6g2000cwy.googlegroups.com...
>I was confused with the non-unicode when i insert chinese characters in
> a varchar field using asp page, it accepted the characters and
> displayed correctly. It is good for me, but i was wondering what
> exactly non-unicode is and why acting like that way(I expected to
> receive strange characters in the feedback asp page but i didn't). Can
> anyone tell me the reason?
>|||Thanks for your reply MC, it's all default setting. I can't understand
your other question. It appears to be like ऒझ stored in the
database but it is displayed correctly(the correct character)in asp
pages. what i'm conserning is why the Unicode data can be stored in a
varchar(for non-Unicode) column and retrieved correctly, which i
suppose should not.
On Jan 4, 1:03 pm, "MC" <marko.NOSPAMc...@.gmail.com> wrote:
> What is the collation of the column in the table? Also, did you try
> comparing two columns with that data?
> MC
> "jane" <bide...@.msn.com> wrote in messagenews:1167926378.282209.127980@.6g2000cwy.googlegroups.com...
>
> >I was confused with the non-unicode when i insert chinese characters in
> > a varchar field using asp page, it accepted the characters and
> > displayed correctly. It is good for me, but i was wondering what
> > exactly non-unicode is and why acting like that way(I expected to
> > receive strange characters in the feedback asp page but i didn't). Can
> > anyone tell me the reason... Hide quoted text -- Show quoted text -|||Well, basically you're reading the same characters you inserted. My second q
was, did you try comparing on those characters? For example:
Table1 has col1 varchar(100)
Table2 has col2 varchar(100)
Insert same string in both tables (chinese chars). Then see what happens
when you say WHERE col1 = col2 or something like that (thats what I meant by
comparing values). Try the same thing with parameter and comparing values
in columns to parameter...
MC
"jane" <bidepan@.msn.com> wrote in message
news:1167936168.510779.204100@.s80g2000cwa.googlegroups.com...
> Thanks for your reply MC, it's all default setting. I can't understand
> your other question. It appears to be like ऒझ stored in the
> database but it is displayed correctly(the correct character)in asp
> pages. what i'm conserning is why the Unicode data can be stored in a
> varchar(for non-Unicode) column and retrieved correctly, which i
> suppose should not.
> On Jan 4, 1:03 pm, "MC" <marko.NOSPAMc...@.gmail.com> wrote:
>> What is the collation of the column in the table? Also, did you try
>> comparing two columns with that data?
>> MC
>> "jane" <bide...@.msn.com> wrote in
>> messagenews:1167926378.282209.127980@.6g2000cwy.googlegroups.com...
>>
>> >I was confused with the non-unicode when i insert chinese characters in
>> > a varchar field using asp page, it accepted the characters and
>> > displayed correctly. It is good for me, but i was wondering what
>> > exactly non-unicode is and why acting like that way(I expected to
>> > receive strange characters in the feedback asp page but i didn't). Can
>> > anyone tell me the reason... Hide quoted text -- Show quoted text -
>

I'm confused with the non-unicode

I was confused with the non-unicode when i insert chinese characters in
a varchar field using asp page, it accepted the characters and
displayed correctly. It is good for me, but i was wondering what
exactly non-unicode is and why acting like that way(I expected to
receive strange characters in the feedback asp page but i didn't). Can
anyone tell me the reason?What is the collation of the column in the table? Also, did you try
comparing two columns with that data?
MC
"jane" <bidepan@.msn.com> wrote in message
news:1167926378.282209.127980@.6g2000cwy.googlegroups.com...
>I was confused with the non-unicode when i insert chinese characters in
> a varchar field using asp page, it accepted the characters and
> displayed correctly. It is good for me, but i was wondering what
> exactly non-unicode is and why acting like that way(I expected to
> receive strange characters in the feedback asp page but i didn't). Can
> anyone tell me the reason?
>|||Thanks for your reply MC, it's all default setting. I can't understand
your other question. It appears to be like ऒझ stored in the
database but it is displayed correctly(the correct character)in asp
pages. what i'm conserning is why the Unicode data can be stored in a
varchar(for non-Unicode) column and retrieved correctly, which i
suppose should not.
On Jan 4, 1:03 pm, "MC" <marko.NOSPAMc...@.gmail.com> wrote:[vbcol=seagreen]
> What is the collation of the column in the table? Also, did you try
> comparing two columns with that data?
> MC
> "jane" <bide...@.msn.com> wrote in messagenews:1167926378.282209.127980@.6g2
000cwy.googlegroups.com...
>
>|||Well, basically you're reading the same characters you inserted. My second q
was, did you try comparing on those characters? For example:
Table1 has col1 varchar(100)
Table2 has col2 varchar(100)
Insert same string in both tables (chinese chars). Then see what happens
when you say WHERE col1 = col2 or something like that (thats what I meant by
comparing values). Try the same thing with parameter and comparing values
in columns to parameter...
MC
"jane" <bidepan@.msn.com> wrote in message
news:1167936168.510779.204100@.s80g2000cwa.googlegroups.com...
> Thanks for your reply MC, it's all default setting. I can't understand
> your other question. It appears to be like ऒझ stored in the
> database but it is displayed correctly(the correct character)in asp
> pages. what i'm conserning is why the Unicode data can be stored in a
> varchar(for non-Unicode) column and retrieved correctly, which i
> suppose should not.
> On Jan 4, 1:03 pm, "MC" <marko.NOSPAMc...@.gmail.com> wrote:
>

Friday, March 9, 2012

IIS6, VPN, SQL Server 2000

If we have a SQL Server 2000 database on our internal LAN and an
external IIS6 Server with ASP.NET pages using SQL Authentication talking
to the SQL Server through the Internet "cloud" via VPN/Firewall Gateway
devices on either end of the connection (with port 1433 enabled), would
the traffic over the VPN be transparent to SQL Server or do we need to
configure SQL Server to handle it? We are running Windows 2003 server.
Thanks
TimoSQL-- IIS --VPN--Internet--VPN
I'm asuming this is your configuration..
So if your configuration is like this, then once the VPN tunnel is made,
then whatever protocols you're using will be sent across the VPN.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||Kevin,
Thanks for the reply. Actually, we will have two IIS Servers, IIS#1 on
our internal LAN used for intranet apps, IIS#2 external for internet
apps visible to the public. The configuration would be like this:
{LAN: IIS#1--SQL } --VPN--{tunnel}--VPN--IIS#2--{Internet}
If I understand you correctly, when SQL gets the request from the IIS#
2, the traffic will look to SQL no different from any other traffic over
port 1433, even though it has come through the tunnel.
Apart from making sure the VPN/Firewall has port 1433 open, is there
anything else required of the VPN to support traffic between SQL and
IIS#2?
Timo
In article <X3QoXmmJEHA.3088@.cpmsftngxa10.phx.gbl>,
kevmc@.online.microsoft.com says...
> SQL-- IIS --VPN--Internet--VPN
> I'm asuming this is your configuration..
> So if your configuration is like this, then once the VPN tunnel is made,
> then whatever protocols you're using will be sent across the VPN.
>
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.|||From what I can see your analysis is correct.
Cheers
Ken
"Timo" <t@.anonymous.com> wrote in message
news:MPG.1aeed52797260409896be@.msnews.microsoft.com...
: Kevin,
: Thanks for the reply. Actually, we will have two IIS Servers, IIS#1 on
: our internal LAN used for intranet apps, IIS#2 external for internet
: apps visible to the public. The configuration would be like this:
:
: {LAN: IIS#1--SQL } --VPN--{tunnel}--VPN--IIS#2--{Internet}
:
: If I understand you correctly, when SQL gets the request from the IIS#
: 2, the traffic will look to SQL no different from any other traffic over
: port 1433, even though it has come through the tunnel.
:
: Apart from making sure the VPN/Firewall has port 1433 open, is there
: anything else required of the VPN to support traffic between SQL and
: IIS#2?
: Timo
:
: In article <X3QoXmmJEHA.3088@.cpmsftngxa10.phx.gbl>,
: kevmc@.online.microsoft.com says...
: >
: > SQL-- IIS --VPN--Internet--VPN
: >
: > I'm asuming this is your configuration..
: > So if your configuration is like this, then once the VPN tunnel is made,
: > then whatever protocols you're using will be sent across the VPN.
: >
: >
: >
: > Thanks,
: >
: > Kevin McDonnell
: > Microsoft Corporation
: >
: > This posting is provided AS IS with no warranties, and confers no
rights.|||previous post;
"If I understand you correctly, when SQL gets the request from the IIS#
2, the traffic will look to SQL no different from any other traffic over
port 1433, even though it has come through the tunnel.
"
Correct.
"Apart from making sure the VPN/Firewall has port 1433 open, is there
anything else required of the VPN to support traffic between SQL and
IIS#2?"
No.
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||Another question has arisen and we don't have a system in place
yet to determine the answer by trial and error.
When IIS6 on somedomain.com communicates with SQLServer2000 on
someotherdomain.net via a VPN, should the Connection String
specify the SQLServer by name with Standard Security:
"Data Source=OurSQLServer;Initial Catalog=pubs;User
Id=sa;Password=foo;"
Or should the Connection String use the IP address mode:
Data Source=xxx.xxx.xxx.xxx,1433;Network Library=DBMSSOCN;Initial
Catalog=pubs;User ID=sa;Password=foo;"
If the Connection String should use the IP address mode with
DBMSSOCN, should it specify the IP address of the firewall (and
let the firewall translate 1433 traffic to the SQLServer by NAT)
or should it specify the IP address of the actual SQL Server?
Thanks!
Timo|||So, if you're on the outside of the firewall, you're client machine has no
knowledge of how to resolve a netbios name on the
inside of the firewall. You should be able to use the IP address of the
firewall, and allow it to NAT to the internal server.
Otherwise, if you want to use the fqdn name, add an entry to your host
file, or lmhost file if you want to use the netbios name.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

IIS/MS SQL/ASP... cant connect

I have an ASP script with the following code in the global.asa:

Application("DBConnectString")="DSN=Test_Server;UID=Michael;PWD=xxxx"

But I get the error:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/TheResort/i_asputils.asp, line 8

Problem:

I setup the ODBC portion and it correctly saw the MS SQL server, and the test connection worked fine. Yet when I ever I enter that ODBC name "Test_Server", and the password of the Win XP Pro user I am signed in as, it fails to connect.

How can I be sure what domain,user,password I need to enter?Ttry using "DSN=asset;UID=;PWD=" and don't forget to insert the user id and password.

Also, when you set up the odbc "system" dsn, remember to click on the test connection button to verify the connection.

http://www.google.com/url?sa=U&start=9&q=http://support.microsoft.com/support/kb/articles/Q169/3/77.asp&e=7415 information.

Wednesday, March 7, 2012

IIS and SQL server securities

Dear all experts,
We have an ASP application previously deployed on machine A, where the web
server (W2K-IIS) and database server (SQLServer 7.0) are installed. When we
try to move the database server to machine B, the ASP application threw an
exception when it tries to connect to the remote database:
Login failed for user 'XXX'. Reason: Not associated with a trusted SQL
server connection.
Both machine A and B do not belong to any domain (but are of the same
workgroup, same subnet.) We googled for it and found some websites suggest
that the SQL Server should be configured to use Windows _AND_ SQL
authentication. However this has no effect since it is already the default
of SQL Server 7.0. Some websites also suggest to use several combinations of
system user account and SQL server user accounts but it didn't solve the
problem either.
Finally, we seem to have found a workable solution. We changed the anonymous
user proxy account (previously IUSR_XXX) in IIS to a sytem user who is in
the local Administrators group and the ASP application works! I know that's
likely not the right way to solve the problem as it would make everyone to
use the Administrators role to execute the ASP application.
So my question is, how should we configure the servers so that the IIS (with
IUSR_XXX role) can talk with the remote SQL Server (with pure
username/password authentication)? How can we completely disable Windows
authentication and access controls?
Thank you very much,
KennethThis article has your solution.
253500 PRB: "Client Unable to Establish Connection" Error Message When
http://support.microsoft.com/?id=253500
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

IIS and SQL Server Persmission Issue

IIS and SQL Server Persmission Issue
I am getting an error trying to run a SQL Server SELECT statement from an
ASP Application.
I am learning ASP/IIS/SQL Server by writing a small ASP app in Dreamweaver.
I've created and tested the ODBC connection just fine. And when I create the
connection in Dreamweaver and run the query it works just fine. However when
I try to access the web page I get:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'ATBSLAPTOP\IUSR_ATBSLAPTOP'.
/webprodmx/categories.asp, line 9
Code is:
Dim MM_webprodmx_STRING
MM_webprodmx_STRING = "dsn=DSNwebprodmxSQL;uid=IUSR_ATBSLAPTOP;
Set rsCategories = Server.CreateObject("ADODB.Recordset")
9: rsCategories.ActiveConnection = MM_webprodmx_STRING
rsCategories.Source = "SELECT * FROM dbo.categories ORDER BY category ASC"
rsCategories.CursorType = 0
The DSN is defined and working (testing outside of dreamweaver, via setup
directly). The database and table exist and have data present. Like I said
it works everyplace else except when going through IIS. I have read some of
the MS Support articles and made sure I am accessing my machine via (local)
so there is no network access. Everything is running on my single local
machine - even IIS and SQL Server 2000.
Any suggestions would be appreciated."Patrick24601" <patrick24601@.yahoo.com> wrote in message
news:ePPTc.4368$wu.1124@.okepread04...
> IIS and SQL Server Persmission Issue
> I am getting an error trying to run a SQL Server SELECT statement from an
> ASP Application.
> I am learning ASP/IIS/SQL Server by writing a small ASP app in
Dreamweaver.
> I've created and tested the ODBC connection just fine. And when I create
the
> connection in Dreamweaver and run the query it works just fine. However
when
> I try to access the web page I get:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
> 'ATBSLAPTOP\IUSR_ATBSLAPTOP'.
> /webprodmx/categories.asp, line 9
Your DSN is set up to use integrated authentication. Change that or give
'ATBSLAPTOP\IUSR_ATBSLAPTOP' rights to connect you your database. It works
outside of IIS because then it's you, not 'ATBSLAPTOP\IUSR_ATBSLAPTOP'
connecting to the database.
David|||Thanks David.
I've gone in and check and that user has SELECT/INSERT/DELETE permissions on
all of the needed tables.
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:%23mp8$gwgEHA.384@.TK2MSFTNGP10.phx.gbl...
> "Patrick24601" <patrick24601@.yahoo.com> wrote in message
> news:ePPTc.4368$wu.1124@.okepread04...
>> IIS and SQL Server Persmission Issue
>> I am getting an error trying to run a SQL Server SELECT statement from an
>> ASP Application.
>> I am learning ASP/IIS/SQL Server by writing a small ASP app in
> Dreamweaver.
>> I've created and tested the ODBC connection just fine. And when I create
> the
>> connection in Dreamweaver and run the query it works just fine. However
> when
>> I try to access the web page I get:
>> Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
>> [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
>> 'ATBSLAPTOP\IUSR_ATBSLAPTOP'.
>> /webprodmx/categories.asp, line 9
> Your DSN is set up to use integrated authentication. Change that or give
> 'ATBSLAPTOP\IUSR_ATBSLAPTOP' rights to connect you your database. It
> works
> outside of IIS because then it's you, not 'ATBSLAPTOP\IUSR_ATBSLAPTOP'
> connecting to the database.
> David
>|||Thanks all for your responses on this.
What I ended up doing (although maybe not the best solution) is to create an
explicitly new userid on the SQL server and use that for everything.
Patrick
"Patrick24601" <patrick24601@.yahoo.com> wrote in message
news:ePPTc.4368$wu.1124@.okepread04...
> IIS and SQL Server Persmission Issue
> I am getting an error trying to run a SQL Server SELECT statement from an
> ASP Application.
> I am learning ASP/IIS/SQL Server by writing a small ASP app in
> Dreamweaver. I've created and tested the ODBC connection just fine. And
> when I create the connection in Dreamweaver and run the query it works
> just fine. However when I try to access the web page I get:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
> 'ATBSLAPTOP\IUSR_ATBSLAPTOP'.
> /webprodmx/categories.asp, line 9
> Code is:
> Dim MM_webprodmx_STRING
> MM_webprodmx_STRING = "dsn=DSNwebprodmxSQL;uid=IUSR_ATBSLAPTOP;
> Set rsCategories = Server.CreateObject("ADODB.Recordset")
> 9: rsCategories.ActiveConnection = MM_webprodmx_STRING
> rsCategories.Source = "SELECT * FROM dbo.categories ORDER BY category ASC"
> rsCategories.CursorType = 0
> The DSN is defined and working (testing outside of dreamweaver, via setup
> directly). The database and table exist and have data present. Like I said
> it works everyplace else except when going through IIS. I have read some
> of the MS Support articles and made sure I am accessing my machine via
> (local) so there is no network access. Everything is running on my single
> local machine - even IIS and SQL Server 2000.
> Any suggestions would be appreciated.
>

IIS and SQL on same server?

Are there any problems with running an ASP based application over IIS and
the SQL Server to supply data to this application from the same physical
server?
This will not be a heavy-use application/database - probably about 25-50
users, only about 5-10 concurrent I would have thought.Hardware wise there are no problems; just install the proper hardware, i.e.,
memory & processing. But you have to consider security. Typically your db
server will be behind the firewall and the web server will be in a DMZ
(technically also behind a firewall.) For fairly obvious reasons, this is
because web servers can typically be hacked through weaknesses in the web
page's code and weaknesses in IIS. This really falls under the "even though
it _can_ be done, should I do it?"
Your main concern should be security; first and foremost. I would not do
it.
hth
Eric
"Keith" <@..> wrote in message
news:%23vOIzuyEEHA.1368@.TK2MSFTNGP11.phx.gbl...
> Are there any problems with running an ASP based application over IIS and
> the SQL Server to supply data to this application from the same physical
> server?
> This will not be a heavy-use application/database - probably about 25-50
> users, only about 5-10 concurrent I would have thought.
>|||Thanks
I had not thought of that until you mentioned it, but it is a very good
point.
Two servers it is then.
"Eric Sabine" <mopar41@.___ho_y_tmail.ScPoAmM> wrote in message
news:%23YZn2DzEEHA.2076@.TK2MSFTNGP09.phx.gbl...
> hardware wise there are no problems; just install the proper hardware,
i.e.,
> memory & processing. But you have to consider security. Typically your
db
> server will be behind the firewall and the web server will be in a DMZ
> (technically also behind a firewall.) For fairly obvious reasons, this is
> because web servers can typically be hacked through weaknesses in the web
> page's code and weaknesses in IIS. This really falls under the "even
though
> it _can_ be done, should I do it?"
> Your main concern should be security; first and foremost. I would not do
> it.
> hth
> Eric
>
> "Keith" <@..> wrote in message
> news:%23vOIzuyEEHA.1368@.TK2MSFTNGP11.phx.gbl...
and
>|||That's my philosophy too. Yes you can, no you shouldn't.
"Keith" <@..> wrote in message news:%23$4TbNzEEHA.628@.TK2MSFTNGP10.phx.gbl...
> Thanks
> I had not thought of that until you mentioned it, but it is a very good
> point.
> Two servers it is then.
>
> "Eric Sabine" <mopar41@.___ho_y_tmail.ScPoAmM> wrote in message
> news:%23YZn2DzEEHA.2076@.TK2MSFTNGP09.phx.gbl...
> i.e.,
> db
is
web
> though
do
> and
physical
25-50
>

IIS (ASP) -> SQLServer Authentication Issue

I have seen numerous pages and forum e-mails about this issue on the
Internet and would like to know if someone can tell me if it is possible to
do the following:
- IIS 6 machine serving ASP pages, integrated authentication, machine
trusted for delegation in the domain
- SQLServer 2000 machine with mixed authentication (same domain as IIS 6
machine)
- I want the ASP pages to access the SQLServer machine using the
authentication credentials provided to IIS as part of integrated
authentication
As far as I can determine, it should be possible as covered in this article
http://support.microsoft.com/kb/319723/en-us. However, I'm currently
getting the error:
Microsoft OLE DB Provider for SQL Server error '80004005'
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
My problem is that I've tried to make this work in our environment in the
past without success. A couple of months ago, it suddenly started working,
and then recently (a day ago) stopped again. The system administrators say
no changes were made that would cause it to stop working.
When researching this issue again on the Internet I did not find many people
trying to do what I wanted to do. Understandably, most people are
interested in solutions where the users accessing the web pages are not
domain users that have access to the SQLServer database - but in my
situation that's what I have. The only solutions I saw offered to this
solution were to turn on Basic Authentication (I know this will work, but do
not want to do this as it negatively impacts the user experience and do not
want passwords crossing the network in the clear) or to setup some other
domain account (I don't want to do this because I want to be using the user
accounts) that IIS would use to access SQLServer. No mention was made of
the kerberos/delegation solution that I identified above.
Is it possible to do what the article describes above? Is there any reason
it should not work? Has anyone had success with the above article?
Thanks, TylerHello Tyler,
I understand that you'd like to use IIS Intergration authentication in the
intranet, and ASP "impersonates" authencitaed users to access SQL Server on
a different machine in the same domain. However, you receive
'80004005'error. If I'm off-base, please let me know.
As you know, only kerberos authentication allows double-hops from clients
via IIS to SQL Server. Windows NT Challenge/Response does not support
double-hop impersonations (meaning that once passed to the IIS server, the
same credentials cannot be passed to a back-end server for authentication,
for example, when IIS uses Windows NT Challenge/Response, it cannot then
authenticate the user against a SQL Server database on another computer by
using SQL Integrated security). Please the following article for details:
How IIS authenticates browser clients
http://support.microsoft.com/defaul...kb;en-us;264921
Per your question, it is possible that IIS uses kerberos authentication and
impersontes the domain user to access backend SQL Server. This is also what
described in 319723. Though some old KBs mention that ASP/IIS must use
Basic Authentication if SQL Server is on a diferent machine, it is not true
any more.
INF: Authentication Methods for Connections to SQL Server in Active Server
Pages
http://support.microsoft.com/defaul...kb;en-us;247931
PRB: "Client Unable to Establish Connection" Error Message When Connecting
from ASP to SQL Server
http://support.microsoft.com/defaul...kb;en-us;253500
You may want to start from 319723 which I think you have done. Also, you
must use TCPIP for Kerberos of SQL Server. Named pipes do not support
Kerberos delegation. Named pipes use NTLM only.
From the error, "Login failed for user '(null)'", it seems the your SQL
Server doesn't have an SPN registered properly. I suggest that you manually
add the SPN
setspn -A MSSQLSvc/<FQDN of SQL Server>:<port> <Sql Service Account>
setspn -A MSSQLSvc/<server hostname>:<port> <Sql Service Account>
For example:
setspn -A MSSQLSvc/sql1.test.com:1433 testdomain\sqlservice
setspn -A MSSQLSvc/sql1:1433 testdomain\sqlservice
You may want to use the following command to see the SPN registred to the
sql server startup account.
setspn -L <domain name>\<sql server startup account>
How to troubleshoot the "Cannot generate SSPI context" error message
http://support.microsoft.com/kb/811889
If the issue persists, you may want to enable security event logging and
Kerberos event logging on both SQL Server and IIS Server to see more
details:
How to troubleshoot Kerberos-related issues in IIS
http://support.microsoft.com/kb/326985/
262177 How to enable Kerberos event logging
http://support.microsoft.com/kb/262177
If the Internet Explorer client is set to use a proxy server, you must
click to select the Bypass Proxy Server for local addresses check box. To
verify that the Internet Explorer client is set to use a proxy server, this
follow these steps: a. Start Internet Explorer.
b. On the Tools menu, click Internet Options, and then click the
Connections tab.
c. Click LAN Settings. Under Proxy server, verify that the Bypass proxy
server for local address check box is checked.
Also, if Anonymous authentication is enabled, IIS will always try to
authenticate by using it first, even if other methods are enabled. If
Anonymous authentication, Integrated Windows authentication, and Basic
authentication are all selected, Integrated Windows authentication takes
precedence over Basic authentication, after Anonymous authentication.
More related information
Troubleshooting Kerberos Delegation
http://www.microsoft.com/downloads/...f94f-e28a-4726-
bffe-2f64ae2f59a2&displaylang=en
Download the Kerbtray and verify Kerberos tickets from any of the
associated computers that are being used.
http://www.microsoft.com/windows200...isting/kerbtray
-o.asp
If you have any update, please feel free to let's know. Thank you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Community Support
========================================
==========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications
<http://msdn.microsoft.com/subscript...ps/default.aspx>.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
<http://msdn.microsoft.com/subscript...rt/default.aspx>.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.|||You have described exactly what we want to see work. I will let you know if
I'm still not able to get it working with all of the information you've
problem.
Thank you very much,
Tyler|||Hello Tyler,
If you have any update, please feel free to let's know. Thank you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============|||Hello Tyler,
I'm still interested in this issue. Do you have any update of the test? If
you have any comments or questions, please feel free to let's know. We look
forward to hearing from you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============|||Hi Peter,
The information and links you provided were quite helpful. I believe it was
an SPN problem, but unfortunately I cannot say for certain. I had to hand
the information and request off to another member of our IT Support team to
resolve because I am not a domain administrator and didn't have the
necessary access rights to perform all of the diagnosis. I am glad to
report though that the issue has been resolved and things are working as we
expect.
Thanks very much for your assistance with this issue - your help was
invaluable
Tyler
"Peter Yang [MSFT]" <petery@.online.microsoft.com> wrote in message
news:pUb3csfNHHA.2300@.TK2MSFTNGHUB02.phx.gbl...
> Hello Tyler,
> I'm still interested in this issue. Do you have any update of the test?
> If
> you have any comments or questions, please feel free to let's know. We
> look
> forward to hearing from you.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
>
> ========================================
=============
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> ========================================
==============
>|||Hello Tyler,
My Pleasure. :-)
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============