Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > IIS Management and ASP.Net Impersonation

Reply
Thread Tools

IIS Management and ASP.Net Impersonation

 
 
Mick Walker
Guest
Posts: n/a
 
      10-23-2007
I am attempting to write a web application that will allow various users
(under very tight security) to control IIS.

I am using Microsoft.Web.Administration.dll to do this.

If I try the following:

ServerManager iisManager = new ServerManager();
iisManager.Sites.Add("NewSite", "http", "*:8080:", "d:\\MySite");
iisManager.CommitChanges();

I get the error:

Filename: redirection.config
Error: Cannot read configuration file due to insufficient permissions


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.UnauthorizedAccessException: Filename:
redirection.config
Error: Cannot read configuration file due to insufficient permissions



ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
or Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the
boxes for the desired access.


What account should I set ASP.Net to impersonate to be able to have the
required permissions for this operation?

Regards
Mick Walker
 
Reply With Quote
 
 
 
 
Ken Schaefer
Guest
Posts: n/a
 
      10-24-2007
Hi,

I am going to assuing you are using IIS 7.0

redirection.config is used when enabling IIS 7.0's "shared configuration"
feature. This allows you to store IIS 7.0 configuration on a remote file
share, rather than locally in the default location.

By default, only users in the local Administrators group have permission to
alter this file. Additionally, the LocalSystem account (which is what the
Windows Activation Service and IIS Admin Service run as) must have
permission to read this file in order to read it's contents.

So you can either:
a) impersonate a user in the Administrators group
b) grant an additional user Read permissions to this file, and impersonate
this second user (this would obviuosly be the more secure way of doing
things)

Cheers
Ken

"Mick Walker" <> wrote in message
news:...
>I am attempting to write a web application that will allow various users
>(under very tight security) to control IIS.
>
> I am using Microsoft.Web.Administration.dll to do this.
>
> If I try the following:
>
> ServerManager iisManager = new ServerManager();
> iisManager.Sites.Add("NewSite", "http", "*:8080:", "d:\\MySite");
> iisManager.CommitChanges();
>
> I get the error:
>
> Filename: redirection.config
> Error: Cannot read configuration file due to insufficient permissions
>
>
> 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.UnauthorizedAccessException: Filename:
> redirection.config
> Error: Cannot read configuration file due to insufficient permissions
>
>
>
> ASP.NET is not authorized to access the requested resource. Consider
> granting access rights to the resource to the ASP.NET request identity.
> ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
> or Network Service on IIS 6) that is used if the application is not
> impersonating. If the application is impersonating via <identity
> impersonate="true"/>, the identity will be the anonymous user (typically
> IUSR_MACHINENAME) or the authenticated request user.
>
> To grant ASP.NET access to a file, right-click the file in Explorer,
> choose "Properties" and select the Security tab. Click "Add" to add the
> appropriate user or group. Highlight the ASP.NET account, and check the
> boxes for the desired access.
>
>
> What account should I set ASP.Net to impersonate to be able to have the
> required permissions for this operation?
>
> Regards
> Mick Walker


 
Reply With Quote
 
 
 
 
Mick Walker
Guest
Posts: n/a
 
      10-24-2007
Ken Schaefer wrote:
> Hi,
>
> I am going to assuing you are using IIS 7.0
>
> redirection.config is used when enabling IIS 7.0's "shared
> configuration" feature. This allows you to store IIS 7.0 configuration
> on a remote file share, rather than locally in the default location.
>
> By default, only users in the local Administrators group have permission
> to alter this file. Additionally, the LocalSystem account (which is what
> the Windows Activation Service and IIS Admin Service run as) must have
> permission to read this file in order to read it's contents.
>
> So you can either:
> a) impersonate a user in the Administrators group
> b) grant an additional user Read permissions to this file, and
> impersonate this second user (this would obviuosly be the more secure
> way of doing things)
>
> Cheers
> Ken

Thanks for that reply Ken.

Obviously security needs to be at its tightest even though the system
will only be used locally.
I am just wondering would it be possible to store multiple servers
redirections.config files in a network share? And manage them from a
single instance of IIS?
Or would it be better to simply create an Instance of the Hosting
Provisioning tool on each seperate server and redirect based on the
server selected by the user?

For a better idea of what I am doing here, see:
http://groups.google.co.uk/group/mic...c7d13accc6c1b1
 
Reply With Quote
 
Ken Schaefer
Guest
Posts: n/a
 
      10-24-2007
Hi,

You could just buy one of the existing solutions out there (like Helm).

The redirection.config file is always local. It stores the location of where
the server's applicationHost.config (and other config files are) if those
files aren't stored in the default directory.

Cheers
Ken


"Mick Walker" <> wrote in message
news:...
> Ken Schaefer wrote:
>> Hi,
>>
>> I am going to assuing you are using IIS 7.0
>>
>> redirection.config is used when enabling IIS 7.0's "shared configuration"
>> feature. This allows you to store IIS 7.0 configuration on a remote file
>> share, rather than locally in the default location.
>>
>> By default, only users in the local Administrators group have permission
>> to alter this file. Additionally, the LocalSystem account (which is what
>> the Windows Activation Service and IIS Admin Service run as) must have
>> permission to read this file in order to read it's contents.
>>
>> So you can either:
>> a) impersonate a user in the Administrators group
>> b) grant an additional user Read permissions to this file, and
>> impersonate this second user (this would obviuosly be the more secure way
>> of doing things)
>>
>> Cheers
>> Ken

> Thanks for that reply Ken.
>
> Obviously security needs to be at its tightest even though the system will
> only be used locally.
> I am just wondering would it be possible to store multiple servers
> redirections.config files in a network share? And manage them from a
> single instance of IIS?
> Or would it be better to simply create an Instance of the Hosting
> Provisioning tool on each seperate server and redirect based on the server
> selected by the user?
>
> For a better idea of what I am doing here, see:
> http://groups.google.co.uk/group/mic...c7d13accc6c1b1


 
Reply With Quote
 
Mick Walker
Guest
Posts: n/a
 
      10-24-2007
Ken Schaefer wrote:
> Hi,
>
> You could just buy one of the existing solutions out there (like Helm).
>
> The redirection.config file is always local. It stores the location of
> where the server's applicationHost.config (and other config files are)
> if those files aren't stored in the default directory.
>
> Cheers
> Ken
>
>

Normally would agree with you, however we looked at various options,
Helm, Plesk etc. And all of these would require substantial internal
development to intergrate with other existing systems such as Active
Directory and our in house billing system, as it is not just a cause of
billing for hosting, but more full Media management (broadband, dial up,
Telephone, TV - and it gets more complex due to the fact we serve the
whole of Ireland (North and South) so we have the issue that the North
uses GBP and the South uses Euros).
Were also partnering with the Microsoft RDP team on this, so we are
recieving investment of time and resources in return for becoming a
windows 2008 case study.
At the moment all updates to IIS are done manually. So were just trying
to create a tool which can automate the process and 'talk' to our
billing system (and log actions as this is something which isnt done!).
 
Reply With Quote
 
Kamal Reddy Kamal Reddy is offline
Junior Member
Join Date: Jan 2012
Posts: 1
 
      01-02-2012
[QUOTE=Ken Schaefer;3109285]Hi,

I am going to assuing you are using IIS 7.0

redirection.config is used when enabling IIS 7.0's "shared configuration"
feature. This allows you to store IIS 7.0 configuration on a remote file
share, rather than locally in the default location.

By default, only users in the local Administrators group have permission to
alter this file. Additionally, the LocalSystem account (which is what the
Windows Activation Service and IIS Admin Service run as) must have
permission to read this file in order to read it's contents.

So you can either:
a) impersonate a user in the Administrators group
b) grant an additional user Read permissions to this file, and impersonate
this second user (this would obviuosly be the more secure way of doing
things)

Cheers
Ken

Hi Ken,

I am a noob. Just started learning asp. I got the same error about having not enough permissions to edit redirection.config file. I understood what u said but please tell me how to do that exactly ie., grant read permissions to additional user.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IIS seetings for impersonation with basic authenticaion and Anonymous access sitaramig Software 0 06-03-2007 06:48 AM
problems with IIS impersonation =?Utf-8?B?U3JpZGhhcg==?= ASP .Net 1 08-28-2006 09:01 PM
IIS impersonation issues for in-proc registered assembly Rob Schieber ASP .Net 0 10-17-2005 06:06 PM
ASP.NET/IIS Authentication and Impersonation Michael A. Jensen ASP .Net Security 1 06-07-2005 04:37 PM
IIS 6 Application Pooling rather than Impersonation Mark ASP .Net 1 02-13-2004 03:51 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57