|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Password protect .mdb fileI'm using AccessDataSources to access my .mdb file, like so... <asp:AccessDataSource ID="adsStory" runat="server" DataFile="~/App_Data/MyDB.mdb" SelectCommand="SELECT * FROM Table WHERE ColumID = ?"> <SelectParameters> <asp:QueryStringParameter Type="Int32" QueryStringField="id" /> </SelectParameters> </asp:AccessDataSource> I want to password protect the database in Access, so that if someone downloads it they can't get to the data. How do I do that, and still able to open the database from my AccessDataSource? Obviously, I don't want the cleartext password in any of my .aspx pages. Thanks, Dan You shouldn't. You would have to hardcode the database password, and that
would be like posting it on the internet. Oh, wait, it would *be* posting it on the internet. Robin S. ------------------------ Show quoteHide quote "musosdev" <musoswire@community.nospam> wrote in message news:6AF0B36A-503E-46E9-BE32-5FB0C0602363@microsoft.com... > Hi > > I'm using AccessDataSources to access my .mdb file, like so... > > <asp:AccessDataSource ID="adsStory" runat="server" > DataFile="~/App_Data/MyDB.mdb" > SelectCommand="SELECT * FROM Table WHERE ColumID = ?"> > <SelectParameters> > <asp:QueryStringParameter Type="Int32" > QueryStringField="id" /> > </SelectParameters> > </asp:AccessDataSource> > > I want to password protect the database in Access, so that if someone > downloads it they can't get to the data. How do I do that, and still able > to > open the database from my AccessDataSource? > > Obviously, I don't want the cleartext password in any of my .aspx pages. > > Thanks, > > > > Dan Hi Dan
The AccessDataSource can not connect to an Access database that is password-protected. However you can retrieve data from a password-protected Access database, use the SqlDataSource control. Drag a SqlDataSource from toolbar on your design page. Open the "Configure Data Source" dialog and click "New Connection" button. Change the DataSource from "Microsoft SQL Server (SqlClient)" to "Microsoft Access Database File (OLE DB)" Then type your filename and password into textbox. (also check "Save my password"). Additionally, for the security issue, you can save the connect string into web.config file. Please feel free to let me know if you have anything unclear. I will follow up. Hope this helps, Sincerely, Wen Yuan On Tue, 13 Mar 2007 13:04:13 -0700, musosdev <musoswire@community.nospam> wrote:
¤ Hi ¤ ¤ I'm using AccessDataSources to access my .mdb file, like so... ¤ ¤ <asp:AccessDataSource ID="adsStory" runat="server" ¤ DataFile="~/App_Data/MyDB.mdb" ¤ SelectCommand="SELECT * FROM Table WHERE ColumID = ?"> ¤ <SelectParameters> ¤ <asp:QueryStringParameter Type="Int32" ¤ QueryStringField="id" /> ¤ </SelectParameters> ¤ </asp:AccessDataSource> ¤ ¤ I want to password protect the database in Access, so that if someone ¤ downloads it they can't get to the data. How do I do that, and still able to ¤ open the database from my AccessDataSource? ¤ ¤ Obviously, I don't want the cleartext password in any of my .aspx pages. ¤ ¤ Thanks, If the connection string to the database is stored in your web.config file you can modify it there. You can check the following for the connection string syntax and database password argument: http://www.connectionstrings.com/?carrier=access Paul ~~~~ Microsoft MVP (Visual Basic) Hi guys
Thanks for the info - much appreciated. I'll give it ago! Ta Dan Show quoteHide quote "Paul Clement" wrote: > On Tue, 13 Mar 2007 13:04:13 -0700, musosdev <musoswire@community.nospam> wrote: > > ¤ Hi > ¤ > ¤ I'm using AccessDataSources to access my .mdb file, like so... > ¤ > ¤ <asp:AccessDataSource ID="adsStory" runat="server" > ¤ DataFile="~/App_Data/MyDB.mdb" > ¤ SelectCommand="SELECT * FROM Table WHERE ColumID = ?"> > ¤ <SelectParameters> > ¤ <asp:QueryStringParameter Type="Int32" > ¤ QueryStringField="id" /> > ¤ </SelectParameters> > ¤ </asp:AccessDataSource> > ¤ > ¤ I want to password protect the database in Access, so that if someone > ¤ downloads it they can't get to the data. How do I do that, and still able to > ¤ open the database from my AccessDataSource? > ¤ > ¤ Obviously, I don't want the cleartext password in any of my .aspx pages. > ¤ > ¤ Thanks, > > If the connection string to the database is stored in your web.config file you can modify it there. > You can check the following for the connection string syntax and database password argument: > > http://www.connectionstrings.com/?carrier=access > > > Paul > ~~~~ > Microsoft MVP (Visual Basic) > Hi guys
I'm having a bit of trouble getting these changes to work. Wonder if someone can explain what I'm missing. I exchanged the AccessDataSource objects for SQLDataSource objects, which look like.. <asp:SqlDataSource ID="sdsTopStories" runat="server" ConnectionString="<%$ ConnectionStrings:sdsBeggars %>" ProviderName="<%$ ConnectionStrings:sdsBeggars.ProviderName %>" SelectCommand="..."> </asp:SqlDataSource> and changed the DataSourceID of my Repeater to "sdsTopStories". VS added a connection strings element to web config which looks like... <add name="sdsBeggars" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Beggars.mdb;Persist Security Info=True;Jet OLEDB:Database Password="my password"" providerName="System.Data.OleDb" /> Which, when I test the connection, seems to work. But I now get the following .net error when I debug my website... (im not passing any paraments to my sql - it doesnt need any) ===================================================== Server Error in /Beggars Application No value given for one or more required parameters. 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.OleDb.OleDbException: No value given for one or more required parameters. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [OleDbException (0x80040e10): No value given for one or more required parameters.] System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +267 System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +192 System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +48 System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +106 System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +111 System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +4 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +141 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770 System.Web.UI.WebControls.Repeater.GetData() +50 System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +232 System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +53 System.Web.UI.WebControls.Repeater.DataBind() +72 System.Web.UI.WebControls.Repeater.EnsureDataBound() +55 System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +12 System.Web.UI.Control.PreRenderRecursiveInternal() +77 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360 =================================================== ________________________________________ Show quoteHide quote "musosdev" wrote: > Hi guys > > Thanks for the info - much appreciated. I'll give it ago! > > Ta > > > Dan > > > > "Paul Clement" wrote: > > > On Tue, 13 Mar 2007 13:04:13 -0700, musosdev <musoswire@community.nospam> wrote: > > > > ¤ Hi > > ¤ > > ¤ I'm using AccessDataSources to access my .mdb file, like so... > > ¤ > > ¤ <asp:AccessDataSource ID="adsStory" runat="server" > > ¤ DataFile="~/App_Data/MyDB.mdb" > > ¤ SelectCommand="SELECT * FROM Table WHERE ColumID = ?"> > > ¤ <SelectParameters> > > ¤ <asp:QueryStringParameter Type="Int32" > > ¤ QueryStringField="id" /> > > ¤ </SelectParameters> > > ¤ </asp:AccessDataSource> > > ¤ > > ¤ I want to password protect the database in Access, so that if someone > > ¤ downloads it they can't get to the data. How do I do that, and still able to > > ¤ open the database from my AccessDataSource? > > ¤ > > ¤ Obviously, I don't want the cleartext password in any of my .aspx pages. > > ¤ > > ¤ Thanks, > > > > If the connection string to the database is stored in your web.config file you can modify it there. > > You can check the following for the connection string syntax and database password argument: > > > > http://www.connectionstrings.com/?carrier=access > > > > > > Paul > > ~~~~ > > Microsoft MVP (Visual Basic) > > Hi again,
Don't worry about my last question - I fixed it. Sorry about that. Cheers Dan Show quoteHide quote "musosdev" wrote: > Hi guys > > I'm having a bit of trouble getting these changes to work. Wonder if someone > can explain what I'm missing. > > I exchanged the AccessDataSource objects for SQLDataSource objects, which > look like.. > > <asp:SqlDataSource ID="sdsTopStories" runat="server" ConnectionString="<%$ > ConnectionStrings:sdsBeggars %>" ProviderName="<%$ > ConnectionStrings:sdsBeggars.ProviderName %>" > SelectCommand="..."> > </asp:SqlDataSource> > > and changed the DataSourceID of my Repeater to "sdsTopStories". > > VS added a connection strings element to web config which looks like... > > <add name="sdsBeggars" > connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data > Source=|DataDirectory|\Beggars.mdb;Persist Security Info=True;Jet > OLEDB:Database Password="my password"" providerName="System.Data.OleDb" /> > > Which, when I test the connection, seems to work. But I now get the > following .net error when I debug my website... (im not passing any paraments > to my sql - it doesnt need any) > > ===================================================== > Server Error in /Beggars Application > > No value given for one or more required parameters. > 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.OleDb.OleDbException: No value given for one > or more required parameters. > > Source Error: > > An unhandled exception was generated during the execution of the current web > request. Information regarding the origin and location of the exception can > be identified using the exception stack trace below. > > Stack Trace: > > > [OleDbException (0x80040e10): No value given for one or more required > parameters.] > > System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS > dbParams, Object& executeResult) +267 > System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) > +192 > System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, > Object& executeResult) +48 > System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior > behavior, String method) +106 > System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +111 > > System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +4 > System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, > DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, > IDbCommand command, CommandBehavior behavior) +141 > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, > Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior > behavior) +137 > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83 > > System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770 > System.Web.UI.WebControls.Repeater.GetData() +50 > System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean > useDataSource) +232 > System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +53 > System.Web.UI.WebControls.Repeater.DataBind() +72 > System.Web.UI.WebControls.Repeater.EnsureDataBound() +55 > System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +12 > System.Web.UI.Control.PreRenderRecursiveInternal() +77 > System.Web.UI.Control.PreRenderRecursiveInternal() +161 > System.Web.UI.Control.PreRenderRecursiveInternal() +161 > System.Web.UI.Control.PreRenderRecursiveInternal() +161 > System.Web.UI.Control.PreRenderRecursiveInternal() +161 > System.Web.UI.Page.ProcessRequestMain(Boolean > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360 > > =================================================== > > > > > > > > > > ________________________________________ > "musosdev" wrote: > > > Hi guys > > > > Thanks for the info - much appreciated. I'll give it ago! > > > > Ta > > > > > > Dan > > > > > > > > "Paul Clement" wrote: > > > > > On Tue, 13 Mar 2007 13:04:13 -0700, musosdev <musoswire@community.nospam> wrote: > > > > > > ¤ Hi > > > ¤ > > > ¤ I'm using AccessDataSources to access my .mdb file, like so... > > > ¤ > > > ¤ <asp:AccessDataSource ID="adsStory" runat="server" > > > ¤ DataFile="~/App_Data/MyDB.mdb" > > > ¤ SelectCommand="SELECT * FROM Table WHERE ColumID = ?"> > > > ¤ <SelectParameters> > > > ¤ <asp:QueryStringParameter Type="Int32" > > > ¤ QueryStringField="id" /> > > > ¤ </SelectParameters> > > > ¤ </asp:AccessDataSource> > > > ¤ > > > ¤ I want to password protect the database in Access, so that if someone > > > ¤ downloads it they can't get to the data. How do I do that, and still able to > > > ¤ open the database from my AccessDataSource? > > > ¤ > > > ¤ Obviously, I don't want the cleartext password in any of my .aspx pages. > > > ¤ > > > ¤ Thanks, > > > > > > If the connection string to the database is stored in your web.config file you can modify it there. > > > You can check the following for the connection string syntax and database password argument: > > > > > > http://www.connectionstrings.com/?carrier=access > > > > > > > > > Paul > > > ~~~~ > > > Microsoft MVP (Visual Basic) > > >
Other interesting topics
Urgent Memory Leak Problem Using Type Dataset. Please help! :-(
Deployment + Vista Eliminating CRUD procedures Writing xml file from dataset different than the original Import text file with DATE column into MS Access Database with VB.NET or C# A search module in c# How can I use connected mode instead of disconnected? Datatable Is it possible to fill a DataSet.DataTable with values from more than one database table? Insert a whole datatable |
|||||||||||||||||||||||