Thursday, March 22, 2012
Custom user field in database
purpose is to hold custom user data?
I have an application for which I need to change the table structure from version to version. Each
time I distribute an new build of the application, the setup program lookupthe DB revision level
then issue the proper DDL calls to perform the updates.
I could always create a small user table with only one column into which I would store the DB
revision level. However, I would prefer store this INT value somewhere else if SQL 2005 offers a
capability to do so.
Gaetan.Look in Books Online about using Database Extended Properties. Relatively
easy to code to, and retrieve from; custom name value pairs.
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"Gaetan" <me@.somewhere.com> wrote in message
news:q4d9m2t2o8suqoo678js6qndkk59721ji5@.4ax.com...
> Is there a SQL 2005 table containing meta data about my database where I
> can set a column whose
> purpose is to hold custom user data?
> I have an application for which I need to change the table structure from
> version to version. Each
> time I distribute an new build of the application, the setup program
> lookupthe DB revision level
> then issue the proper DDL calls to perform the updates.
> I could always create a small user table with only one column into which I
> would store the DB
> revision level. However, I would prefer store this INT value somewhere
> else if SQL 2005 offers a
> capability to do so.
> Gaetan.|||sys.sp_addextendedproperty and sys.sp_updateextendedproperty are exactly what I needed.
Thank you.
Monday, March 19, 2012
Custom Role Provider Everthing working except roles??
Hello Everyone,
I am trying to use a custom role provider, the main purpose so that I don't have to use a database file. My web.config file is posted below. My problem is that I think I have followed all the steps to create a custom role provider using both articles on MSDN and some written by Scott Gu. After Modifying my web.config file I went to the asp.net configuration to test the connection. Users are created in the remote database but roles are being picked up and created in the App_Data folder. Can anyone give me a hint at what I am doing wrong? thanks in advance.
<?
xmlversion="1.0"?><!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<
configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"><
appSettings/><
connectionStrings><
addname="MyConnectionString"connectionString="Data Source=10.10.10.10;Database=MyDataBase;Persist Security Info=True;User ID=user;Password=password"providerName="System.Data.SqlClient"/></
connectionStrings><
system.web><!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
--><
roleManagerenabled="true"/><
membershipdefaultProvider="CustomSQLRoleManager"><
providers><
clear/><
addname="CustomSQLRoleManager"type="System.Web.Security.SqlMembershipProvider"connectionStringName="MyConnectionString"applicationName="MyAppllicationName"minRequiredPasswordLength="6"minRequiredNonalphanumericCharacters="0"requiresQuestionAndAnswer="false"requiresUniqueEmail="true"/></
providers></
membership><
compilationdebug="true"><
assemblies><
addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><
addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation><!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
--><
authenticationmode="Forms"/><!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
--></
system.web></
configuration>Ok. I figured out what I was missing and bolded the lines that I added to my web.config file
<?
xmlversion="1.0"?><!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<
configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"><
appSettings/><
connectionStrings><
removename="LocalSqlServer"/><
addname="MyConnectionString"connectionString="Data Source=10.10.10.10;Database=MyDatabase;Persist Security Info=True;User ID=User;Password=password"providerName="System.Data.SqlClient"/></
connectionStrings><
system.web><!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
--><
roleManagerenabled="true"defaultProvider="CustomSQLRoleManager"><
providers><
clear /><
addconnectionStringName="MyConnectionString"applicationName="MyApp"name="CustomSQLRoleManager"type="System.Web.Security.SQLRoleProvider" /></
providers></
roleManager>
<
membershipdefaultProvider="SQLRoleManager"><
providers><
clear/><
addname="SQLRoleManager"type="System.Web.Security.SqlMembershipProvider"connectionStringName="MyConnectionString"applicationName="MyApp"minRequiredPasswordLength="6"minRequiredNonalphanumericCharacters="0"requiresQuestionAndAnswer="false"requiresUniqueEmail="true"/></
providers></
membership><
compilationdebug="true"><
assemblies><
addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><
addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation><!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
--><
authenticationmode="Forms"/><!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
--></
system.web></
configuration>|||Ok. I figured out what I was missing and bolded the lines that I added to my web.config file
<?
xmlversion="1.0"?><!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<
configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"><
appSettings/><
connectionStrings><
removename="LocalSqlServer"/><
addname="MyConnectionString"connectionString="Data Source=10.10.10.10;Database=MyDatabase;Persist Security Info=True;User ID=User;Password=password"providerName="System.Data.SqlClient"/></
connectionStrings><
system.web><!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
--><
roleManagerenabled="true"defaultProvider="CustomSQLRoleManager"><
providers><
clear /><
addconnectionStringName="MyConnectionString"applicationName="MyApp"name="CustomSQLRoleManager"type="System.Web.Security.SQLRoleProvider" /></
providers></
roleManager>
<
membershipdefaultProvider="SQLRoleManager"><
providers><
clear/><
addname="SQLRoleManager"type="System.Web.Security.SqlMembershipProvider"connectionStringName="MyConnectionString"applicationName="MyApp"minRequiredPasswordLength="6"minRequiredNonalphanumericCharacters="0"requiresQuestionAndAnswer="false"requiresUniqueEmail="true"/></
providers></
membership><
compilationdebug="true"><
assemblies><
addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><
addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation><!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
--><
authenticationmode="Forms"/><!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
--></
system.web></
configuration>