 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 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
|
|
|
|

March 2nd, 2004, 08:03 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
impersonation problems
Hello all!!
I have yet another problem - this time with impersonation (please leave all jokes at the door please) in an application I am try to work on.
I added security to the application and when i try to run queries where I write to the database I am getting the follwoing error:
'Operation must use an updateable query' which I have deduced is something to do with impersonation. I have read an ertical on the MS database which suggested that I turn impersonation on ( http://support.microsoft.com/default...b;en-us;316675) and then I went into the help files in VS, and following the intructions, edited my webconfig file to allow impersonation by adding the following line:
<impersonation enable="true"/>
However, this has now affected other pages which read from the database which used to work before this line was added. Where abouts in the web.config file should this be placed? I have tried moving it various places, but with no joy.
As always, all help gratefully recieved!! :D
Morris
|
|

March 3rd, 2004, 04:17 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
'Operation must use an updateable query' does not necessarily have something to do with impersonation. It has to do with security. Apparently, the account that ASP.NET was running under, didn't have sufficient permissions to do what it had to do (update the database, etc). This account is usually ASPNET or the IWAM_MachineName account.
If you use <impersonation enable="true"/>, the ASP.NET will run under the account that IIS passes to it. If you're using anonymous access in IIS, this account will be IUSR_MachineName. If you're using Integrated Security for example, this account will be you, or any other user using the app.
(Still with me??)
So, IMO, if you want to leave things as they were, set Impersonation back to false, and give the appropriate accounts rights to the database folder. For .NET 1.0, this should be the ASPNET account. For .NET 1.1, I think you'll need to use the IWAM_MachineName account.
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 3rd, 2004, 09:16 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Just in case your test machine is Win 2K3. For a clean install of Windows 2003 Server you should use Network Service account.
|
|

March 3rd, 2004, 01:50 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi all,
I have removed the impersonation tag from the web config file and looked at the settings you suggested - however, it has not seemed to removed the problem.
When I looked at IIS i saw that both anonymous login and Integrated Windows Authenication where selected. I played around with these, unselecting the integrated windows authenication etc, but this didnt work.
I also tried to alter the database folder settings - agin this didnt solve the problem.
Any other ideas?!
Cheers,
Morris
P.S: my box is running win XP and I am hosting IIS on the local machine as well.
|
|

March 3rd, 2004, 01:52 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
On the folder that the database resides, you need to give the ASPNET user account write permissions so your web application can update the database.
|
|

March 3rd, 2004, 02:50 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I am going to show my naivety (and i am embarassed having to ask this  ), but how do I do that?  x10! I have tried to do what you sugest by right clicking>properties>sharing the database folder but the only option i can see is share it through IIS. When i go into IIS, I dont see anywhere I can add users to the folder in IIS.
Alternativly, I could put it into the shared folder on my box - but when i follow the steps above, the only option i have to allow the folder to be shared over the web. And I run into the same problems as above.
Cheers,
|
|

March 3rd, 2004, 03:28 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Don't be. It's not there by default.
Try this:
Open 'My Computer'. Click 'Tools' and then 'Folder Options'. Then click on the 'View' Tab and scroll all the way to the bottom. Uncheck 'Use Simple File Sharing(Recommended)' and click 'Ok' or 'Yes' to the warning.
Once that has been done you should be able to go the the folder where your db.mdb is at and right click on the folder and give <machine name>\aspnet and iusr_<machine name> accounts write access to the folder.
|
|

March 3rd, 2004, 03:31 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
One more thing, you must be using NTFS and NOT FAT16 or FAT32.
|
|

March 3rd, 2004, 06:50 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Right, I think I have that sussed, thanks for all your help!
Now I just got to figure out the rest of my problems - watch this space!!
|
|

March 5th, 2004, 09:52 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey folks,
I stumbled upon something this evening which be of use to someone in the future who reads this post while looking for help with the same problem.
Instead of editing it the settings for the permissions for the folder which the database resides it is also possible to edit the machine.config file. This file sets the access permissions for applications which you can run on your machine.
Search C:\ for this file, open it up and find the <process model> tag. This section, according to MS 'configures the ASP.NET process model settings on a Microsoft Internet Information Services (IIS) Web server. The <processModel> section can be set only within the Machine.config file and affects all ASP.NET applications running on the server.'
When found, edit like so: username="System" - N.B: this is case sensitive! Save this and restart IIS or just reboot your machine (I did this and then it clicked with me that I only needed to restart IIS). This should eliminate errors such as 'Operation must use an updateable query' and so on. For more information, you can read the following link: http://support.microsoft.com/default...b;en-us;316675
As I have already said, this is probably common sense or old news to a lot of you guys, but someone, somewhere might be looking for something like this and i thought it might be useful to post it.
Cheers
Morris
|
|
 |