Couple of IIS 7.5 API questions

  • Thread starter Thread starter taltene
  • Start date Start date
T

taltene

Hi all.

This is regarding the IIS 7.5 API.

1. Does someone know how to set an application pool LoadUserProfile value?

I couldn't even find this attribute as part of the ApplicationPoolDefaults Class members.

2. I wrote the following in order to set Site Browsing to true:

using (m_serverManager)
{
Configuration config = m_serverManager.GetWebConfiguration(m_sSiteName);

ConfigurationSection directoryBrowseSection = config.GetSection("system.webServer/directoryBrowse");
directoryBrowseSection["enabled"] = true;

m_serverManager.CommitChanges();
}

But right after that the server manager object was disposed! Why?

Thanks!
 
2. I wrote the following in order to set Site Browsing to true:

using (m_serverManager)
{

Did that actually compile? I was under the impression that you had to
declare and set a variable inside the parentheses of a using statement.

Regardless, if it did compile, I'll tell you why m_serverManager was
disposed afterwards: because that's what the using statement does! In fact,
that's the entire purpose of the construct. What did you hope to gain from
using using, if not that? (There's some awkward phrasing.)

Your question was akin to saying, "I put x-- in my code and after it
executed, x was 1 less than it was before! Why?"
 
I was under the impression that you had to declare and set a variable
inside the parentheses of a using statement.

Wow, I must be blind. I specifically looked up using in MSDN before posting
and I COMPLETELY missed this example:

Font font2 = new Font("Arial", 10.0f);
using (font2) // not recommended
{
// use font2
}
// font2 is still in scope
// but the method call throws an exception
float f = font2.GetHeight();
 
Back
Top