Wednesday, March 28, 2012
trouble connecting to remote SQL server for authentication
So, I need the user data to be on the same db server as the other
data. I'm trying to do this using the membership API. I've set up the
tables and sprocs and so forth using the aspnet_regsql.exe (though, for
some reason, I had to do it using windows authentication rather than
using a SQL server account). I've modified the web.config file as
follows
<?xml version="1.0" encoding="utf-8"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="SLAR-con" connectionString="Data
Source=mySQLserver;Initial Catalog=SLAR;User
Id=mydomain\myuserid;Password=mypassword
" />
</connectionStrings>
<system.web>
<roleManager enabled="true" />
<authentication mode="Forms" />
<membership>
<providers>
<add connectionStringName="SLAR-con"
applicationName="SLAR" minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
name="CustomizedProvider"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
</system.web>
</configuration>
and I've tested the login and it seems to be working. However, when I
go into the database on the SQL server to look at the user I created,
the user authentication tables are all empty. The data isn't being
stored on the SQL server where I want it to be (I'm assuming it is
being stored in a SQL Server express database on the local machine).
How do I get the data to be stored in the remote SQL server?
----
--Check both databases and make sure it is not pointiong locally. As long as
machine name is correct, you should be on the other server.
NOTE: SQL Server 2005 requires SQL Browser on to connect remotely. You also
have to have proper transports set up, as some versions install without
TCP/IP or named pipes on.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
****************************************
*********
Think outside of the box!
****************************************
*********
<brian.newman@.wpafb.af.mil> wrote in message
news:1161862621.467371.69570@.i3g2000cwc.googlegroups.com...
> I've got an app which provides data based on the user who is logged in.
> So, I need the user data to be on the same db server as the other
> data. I'm trying to do this using the membership API. I've set up the
> tables and sprocs and so forth using the aspnet_regsql.exe (though, for
> some reason, I had to do it using windows authentication rather than
> using a SQL server account). I've modified the web.config file as
> follows
> <?xml version="1.0" encoding="utf-8"?>
> <configuration
> xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
> <connectionStrings>
> <add name="SLAR-con" connectionString="Data
> Source=mySQLserver;Initial Catalog=SLAR;User
> Id=mydomain\myuserid;Password=mypassword
" />
> </connectionStrings>
> <system.web>
> <roleManager enabled="true" />
> <authentication mode="Forms" />
> <membership>
> <providers>
> <add connectionStringName="SLAR-con"
> applicationName="SLAR" minRequiredPasswordLength="5"
> minRequiredNonalphanumericCharacters="0"
> name="CustomizedProvider"
> type="System.Web.Security.SqlMembershipProvider" />
> </providers>
> </membership>
>
> </system.web>
> </configuration>
> and I've tested the login and it seems to be working. However, when I
> go into the database on the SQL server to look at the user I created,
> the user authentication tables are all empty. The data isn't being
> stored on the SQL server where I want it to be (I'm assuming it is
> being stored in a SQL Server express database on the local machine).
> How do I get the data to be stored in the remote SQL server?
>
> ----
--
>
Cowboy (Gregory A. Beamer) wrote:
> Check both databases and make sure it is not pointiong locally. As long as
> machine name is correct, you should be on the other server.
> NOTE: SQL Server 2005 requires SQL Browser on to connect remotely. You als
o
> have to have proper transports set up, as some versions install without
> TCP/IP or named pipes on.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com
> ****************************************
*********
> Think outside of the box!
> ****************************************
*********
> <brian.newman@.wpafb.af.mil> wrote in message
> news:1161862621.467371.69570@.i3g2000cwc.googlegroups.com...
It is being stored locally (local to the machine on which I'm doing the
development), but I'm unclear on how to point it to the SQL server db.
I thought the edits shown in the top post I made to the web.config file
would handle that, but they don't. The SQL server db is SQL Server
2000.
By the way, thanks for the assist. I posted on Microsoft asp.net forum
and got 20 views, but no assist and got nothing from 4guysfromrolla.
trouble connecting to remote SQL server for authentication
So, I need the user data to be on the same db server as the other
data. I'm trying to do this using the membership API. I've set up the
tables and sprocs and so forth using the aspnet_regsql.exe (though, for
some reason, I had to do it using windows authentication rather than
using a SQL server account). I've modified the web.config file as
follows
<?xml version="1.0" encoding="utf-8"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="SLAR-con" connectionString="Data
Source=mySQLserver;Initial Catalog=SLAR;User
Id=mydomain\myuserid;Password=mypassword" />
</connectionStrings>
<system.web>
<roleManager enabled="true" />
<authentication mode="Forms" />
<membership>
<providers>
<add connectionStringName="SLAR-con"
applicationName="SLAR" minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
name="CustomizedProvider"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
</system.web>
</configuration>
and I've tested the login and it seems to be working. However, when I
go into the database on the SQL server to look at the user I created,
the user authentication tables are all empty. The data isn't being
stored on the SQL server where I want it to be (I'm assuming it is
being stored in a SQL Server express database on the local machine).
How do I get the data to be stored in the remote SQL server?
------------------------Check both databases and make sure it is not pointiong locally. As long as
machine name is correct, you should be on the other server.
NOTE: SQL Server 2005 requires SQL Browser on to connect remotely. You also
have to have proper transports set up, as some versions install without
TCP/IP or named pipes on.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
*************************************************
Think outside of the box!
*************************************************
<brian.newman@.wpafb.af.milwrote in message
news:1161862621.467371.69570@.i3g2000cwc.googlegrou ps.com...
Quote:
Originally Posted by
I've got an app which provides data based on the user who is logged in.
So, I need the user data to be on the same db server as the other
data. I'm trying to do this using the membership API. I've set up the
tables and sprocs and so forth using the aspnet_regsql.exe (though, for
some reason, I had to do it using windows authentication rather than
using a SQL server account). I've modified the web.config file as
follows
>
<?xml version="1.0" encoding="utf-8"?>
>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
>
<connectionStrings>
>
<add name="SLAR-con" connectionString="Data
Source=mySQLserver;Initial Catalog=SLAR;User
Id=mydomain\myuserid;Password=mypassword" />
>
</connectionStrings>
>
<system.web>
>
<roleManager enabled="true" />
>
<authentication mode="Forms" />
>
<membership>
>
<providers>
>
<add connectionStringName="SLAR-con"
applicationName="SLAR" minRequiredPasswordLength="5"
>
minRequiredNonalphanumericCharacters="0"
name="CustomizedProvider"
>
type="System.Web.Security.SqlMembershipProvider" />
>
</providers>
>
</membership>
>
>
>
</system.web>
>
</configuration>
>
and I've tested the login and it seems to be working. However, when I
go into the database on the SQL server to look at the user I created,
the user authentication tables are all empty. The data isn't being
stored on the SQL server where I want it to be (I'm assuming it is
being stored in a SQL Server express database on the local machine).
How do I get the data to be stored in the remote SQL server?
>
>
------------------------
>
Cowboy (Gregory A. Beamer) wrote:
Quote:
Originally Posted by
Check both databases and make sure it is not pointiong locally. As long as
machine name is correct, you should be on the other server.
>
NOTE: SQL Server 2005 requires SQL Browser on to connect remotely. You also
have to have proper transports set up, as some versions install without
TCP/IP or named pipes on.
>
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
>
*************************************************
Think outside of the box!
*************************************************
<brian.newman@.wpafb.af.milwrote in message
news:1161862621.467371.69570@.i3g2000cwc.googlegrou ps.com...
Quote:
Originally Posted by
I've got an app which provides data based on the user who is logged in.
So, I need the user data to be on the same db server as the other
data. I'm trying to do this using the membership API. I've set up the
tables and sprocs and so forth using the aspnet_regsql.exe (though, for
some reason, I had to do it using windows authentication rather than
using a SQL server account). I've modified the web.config file as
follows
<?xml version="1.0" encoding="utf-8"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="SLAR-con" connectionString="Data
Source=mySQLserver;Initial Catalog=SLAR;User
Id=mydomain\myuserid;Password=mypassword" />
</connectionStrings>
<system.web>
<roleManager enabled="true" />
<authentication mode="Forms" />
<membership>
<providers>
<add connectionStringName="SLAR-con"
applicationName="SLAR" minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
name="CustomizedProvider"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
</system.web>
</configuration>
and I've tested the login and it seems to be working. However, when I
go into the database on the SQL server to look at the user I created,
the user authentication tables are all empty. The data isn't being
stored on the SQL server where I want it to be (I'm assuming it is
being stored in a SQL Server express database on the local machine).
How do I get the data to be stored in the remote SQL server?
------------------------
It is being stored locally (local to the machine on which I'm doing the
development), but I'm unclear on how to point it to the SQL server db.
I thought the edits shown in the top post I made to the web.config file
would handle that, but they don't. The SQL server db is SQL Server
2000.
By the way, thanks for the assist. I posted on Microsoft asp.net forum
and got 20 views, but no assist and got nothing from 4guysfromrolla.
Monday, March 26, 2012
Trouble getting row count from DataReader
like to set the tables "visible" property based on the the data from my
query. For example, if I have at least one row of data, I will set visible
to true, otherwise, false.
How get I find out if I have at least one row of data? The code below is
from the CodeBehind of my asp form.
*****************************
OracleConnection conn = new OracleConnection(ConnectionString);
OracleCommand cmd = new OracleCommand("select * from customer where name =
'BOB', conn);
try
{
conn.Open();
IDataReader reader = cmd.ExecuteReader();
_grid.DataSource = reader;
_grid.DataBind();
}
finally
{
conn.Dispose();
}
*****************************
Thanks,
KevinI think your only option on a DataReader is to use the .Read property. It
returns false if it can't produce a record.
Otherwise, a dataset is necessary to get the actual record count.
--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz
"Kevin" <kevin@.spammers_die.com> wrote in message
news:OFV8NLZxDHA.2304@.TK2MSFTNGP12.phx.gbl...
> I am using the DataReader to populate an ASP table dynamically. I would
> like to set the tables "visible" property based on the the data from my
> query. For example, if I have at least one row of data, I will set
visible
> to true, otherwise, false.
> How get I find out if I have at least one row of data? The code below is
> from the CodeBehind of my asp form.
> *****************************
> OracleConnection conn = new OracleConnection(ConnectionString);
> OracleCommand cmd = new OracleCommand("select * from customer where name =
> 'BOB', conn);
> try
> {
> conn.Open();
> IDataReader reader = cmd.ExecuteReader();
> _grid.DataSource = reader;
> _grid.DataBind();
> }
> finally
> {
> conn.Dispose();
> }
> *****************************
> Thanks,
> Kevin
Thanks Jerry, that was exactly what I needed.
Kevin
"Jerry Boone" <jerry@.antech.biz.killspam> wrote in message
news:mkmEb.1432$C21.627@.newssvr22.news.prodigy.com ...
> I think your only option on a DataReader is to use the .Read property. It
> returns false if it can't produce a record.
> Otherwise, a dataset is necessary to get the actual record count.
> --
> Jerry Boone
> Analytical Technologies, Inc.
> http://www.antech.biz
>
> "Kevin" <kevin@.spammers_die.com> wrote in message
> news:OFV8NLZxDHA.2304@.TK2MSFTNGP12.phx.gbl...
> > I am using the DataReader to populate an ASP table dynamically. I would
> > like to set the tables "visible" property based on the the data from my
> > query. For example, if I have at least one row of data, I will set
> visible
> > to true, otherwise, false.
> > How get I find out if I have at least one row of data? The code below
is
> > from the CodeBehind of my asp form.
> > *****************************
> > OracleConnection conn = new OracleConnection(ConnectionString);
> > OracleCommand cmd = new OracleCommand("select * from customer where name
=
> > 'BOB', conn);
> > try
> > {
> > conn.Open();
> > IDataReader reader = cmd.ExecuteReader();
> > _grid.DataSource = reader;
> > _grid.DataBind();
> > }
> > finally
> > {
> > conn.Dispose();
> > }
> > *****************************
> > Thanks,
> > Kevin
Saturday, March 24, 2012
Trouble with authentication in asp.net
* Created the user "testuser" on the local machine
* created the group "testgroup" on the local machine
* added testuser -> testgroup
* created an asp.net webapp in IIS and set it to windows authentication
* in explorer, I have added testgroup to read rights on the web app folder.
* Now I run the app, I enter the username and password and it let me in..
BUT when I write User.IsInRole("testgroup") I get "false"... why is that? I should get "true"...
so my problem is with the groups, everything else works fine!!!
whats the problem?
/HenrikHave you set identity impersonation to true?
Yes!! But im not sure it matters?
I have done something similar for a winforms app, but there I fetched the group info from the AD using system.directoryservices and then created genericprincipal and genericidentity... then it works to check Thread.User.IsInRole("wewwq"),,,
im not sure what to do with asp.net to get the same functionality...
/henrik
Maybe you need to disable "anonymous" in the IIS server.
It may be passing "anonymous" instead of the user id.
?
i have disabled anonymous login in the IIS, and set to windows authentication... and I get the correct username when using User.Identity.Name its the groups that dont work correct
/Henrik
Have you restarted the machine for the group changes to take effect? Or tried issuing iisreset at the command prompt?