Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 16th, 2006, 10:38 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default Use MS Access instead of SQLServer for Login Contr

Now that I am learning a bit more about SQL Server, I have a new question. I am trying to do a web site for my church and the hosting company does not have sqlserver. I would like to try using Access instead.

I know that I have used (per the Wrox Beginning ASP.NET 2.0 book) the website administration tool to create the users...access rules..etc.

My questions are:

a) Would I configure the connection first (to Access)
b) assuming yes to above, would ASP.NET build the Access DB?
c) I have noticed, within IIS, an "ASP" tab where you can have a connection in there--in the past (with SQL Server) it has always pointed to the aspnetdb.mdf file---how is this field populated? I never see that string in the web.config file...how would it be changed to point the the ACCESS DB?

Is there a link out there that shows how to use Access for this?

Kind Regards,
Rob Searing

 
Old August 16th, 2006, 01:00 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Rob,

By default, Access is not supported.

However, some time ago, Microsoft released an open source implementation of a provider for Access. It's pretty much feature complete and works pretty well.

You can find it here: http://msdn.microsoft.com/asp.net/downloads/providers/ under Sample Access Providers.

You may also want to take a look here and see what else you can do with the code: http://imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=380

Be aware, if you want to modify the code to work with SQL Server, you better start with the real source for the SQL provider: http://weblogs.asp.net/scottgu/archi...13/442772.aspx

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 16th, 2006, 03:11 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

As always, thanks. Your last statement has me a little confused. What do you mean by stating "..if you want to modify the code to work with SQL Server, you better start with the real soruce". Do you mean that in regards to if I decided to change to Access and go back to SQL Server?

Please help me understand the coorelation of the ASP "tab" in IIS server that has a connection string in there and the web config file? When I was using the web site administration tool, in Visual Studio, to create roles and access rules, I didn't see a connection inside my web.config file--however, I did see one on the ASP tab of IIS.

What scares me is that it's SO automatic and really abstracts alot out for setting up this DB and creating the SQLServer connection string. I wish there was something a little easier to understand than the links you provided from a "beginner's" perspective.

PS--bought your book-going to work on it after Im done with ASP and learning a little bit about dreamweaver.

Kind Regards,
Rob Searing

 
Old August 16th, 2006, 03:54 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Forget about that; sorry for the confusion. I'll try to explain it:

At first, only the Access source was available, as an example of how you should build your own (custom) provider. For my own site, I built a provider based on the Access source, targeting SQL Server. After my provider was done, Microsoft also released the source for the SQL Server provider.

However, if you're not interested in writing (or customizing) your own providers, you don't need to worry about it. You can just use the Access provider as is and that's it. I just don't think it's easy (or even possible) to upsize data from Access to SQL Server later, because both use different identifiers. This is something to keep in mind.

When you're using the Access version, you probably don't need the ConnectionString setting from the ASP.NET tab anymore. You can configure the connection string directly in the web.config file, like this:

<add name="AccessFileName" connectionString="~/App_Data/ASPNetDB.mdb"
    providerName="System.Data.OleDb"
/>

Look in the web.config file that comes with the sample; it contains everything you need to configure an app to use the Access providers.

I realize this stuff may not be for beginners. The problem is: for true beginners, the automated stuff is just great. You don't need to worry about anything as it just works. However, if you want to know just a little bit about how it works, you open a can of worms and get to see a lot of code. Take a look at the AccessMembershipProvider.cs file to see what I mean. 1841 lines of code to make it work.

But, you don't have to worry about all of this. Compile the project to a DLL and use it like you use the other provider features. When you're ready to learn more, open up the project again and examine the code.

Also, when you Google for ASP.NET Membership provider, I am sure you'll find a lot of high level overview articles describing the global process of the membership and other providers.


Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 16th, 2006, 04:03 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

Ok--thanks..last question....If I'm using VB for my aspx pages--I can add the attached files (which I believe are CS) ?? Then I wouldn't have to change anything in my code but point to the AccessProvider?..basically change sqldatasource to access....

LASTLY--when I do all this in the web site administration tool--its all automatic--how do i get it so that when I go through that to set up users and access rules--it points/creates this access DB solution?

ANY possible way--if you get some time, you could do a step / step on how/where to put the CS files and then have it so that I can use Access for the provider so that when using WAT it does it in Access? Right now I just create the roles in the tool and it creates the SQL Server DB all on its own.

Imar--thank you so much sir!!!!!!!

 
Old August 16th, 2006, 04:18 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:If I'm using VB for my aspx pages--I can add the attached files (which I believe are CS) ?? Then I wouldn't have to change anything in my code but point to the AccessProvider?..basically change sqldatasource to access....
Not entirely. You need to compile the project into a DLL. If you have the full version of Visual Studio, just open the project, and compile it. Otherwise, get a copy of the free Visual C# Express Edition that you can use to compile the project.

Then drop the DLL in the Bin folder of your website.
Quote:
quote:when I do all this in the web site administration tool--its all automatic--how do i get it so that when I go through that to set up users and access rules--it points/creates this access DB solution?
Look in the web.config file that comes with the project. It adds nodes like <membership>, similar to the stuff you find in the machine.config file, but now targeting the custom DLL. You'll see stuff like this:
Code:
<membership
  defaultProvider="AccessMembershipProvider">
  <providers>
  <clear/>
     <add name="AccessMembershipProvider" 
      type="Samples.AccessProviders.AccessMembershipProvider, 
SampleAccessProviders" 
    ...
The type= stuff points to the custom assembly (the DLL file).

From this point on, the WAT should see your database.
Quote:
quote:ANY possible way--if you get some time, you could do a step / step on how/where to put the CS files and then have it so that I can use Access for the provider so that when using WAT it does it in Access? Right now I just create the roles in the tool and it creates the SQL Server DB all on its own.
Good idea, but not right now. I may have time to do something like this over the weekend, but I can't promise anything. Have a lot of other stuff to do as well....
Quote:
quote:Imar--thank you so much sir!!!!!!!
You're welcome.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 16th, 2006, 05:24 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

Imar,

Thank you. I have sent you an email regarding this of more of a personal nature--whenever you get a chance.

As always--THANKS!

 
Old August 16th, 2006, 05:35 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

You know, come to think of it---I don't recall my sites having a bin folder--just an app_data folder. Would I compile this into a bin folder that I create..then will the web site admin tool allow me to select "Access" as a provider?

Man--I am SO sorry...i feel completely stupid for not understanding!

-Rob

 
Old August 17th, 2006, 03:08 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I'll try to get back at this tomorrow; I'll also respond to your personal message then...

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 26th, 2006, 03:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

For anyone interested in using the Microsoft Access Providers to replace the built-in SQL Server Providers for services like Membership, Role Management, Profiles and Personalization: I wrote an article about it that you can find here:

http://Imar.Spaanjaars.Com/QuickDocId.aspx?quickdoc=404

I figured that's probably a lot more useful than writing many posts about the subject in this thread... ;)

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR....!when trying to use a simple custom contr benfowler ASP.NET 1.0 and 1.1 Basics 1 April 28th, 2008 07:39 PM
MS ACCESS 2003 FRONTEND AND MS SQL SERVER 2005 DB mohankumar0709 SQL Server 2005 3 March 23rd, 2007 12:48 AM
login fails after SqlServer Studio has been opened TomH VB Databases Basics 1 October 1st, 2006 04:44 PM
How can I allow remote users to access sqlserver. gowthamsen SQL Server 2000 1 February 18th, 2006 06:10 PM
login -connected to MS access ammy Classic ASP Databases 1 March 24th, 2004 01:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.