Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

078274121, info0a ip, should prodicers of software_based services be held liable or not liable for economic injuries, should producers of soft ware based services such as ATMs be held liable for economic injuries suffered when their systems fail?, nisc wwwxxx, wwwxxx0cm, should producers of software-based services, such as atms, be held liable for economic injuries suffered when their systems fail?, wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry

Links

XODOX
Impressum

#1: Retrieving IIS Web Site Property Value during Application_Start in ASP.NET Web app.

Posted on 2008-04-19 00:36:10 by Peter Schwartz

How would it be possible for an ASP.NET Web application, in it's
Application_Start event procedure, to programmatically determine the Web
site (in IIS) that the Web app is running under/for.

Say for example, that I have a Web site defined in IIS, with the
"Application name" property set to the value "MyWebApp". How could I get
the value "MyWebApp" into a string variable in Application_Start of the
ASP.NET Web application?

Please note that I'd like to get this value directly from IIS, and not have
to manually duplicate it in Web.config.

I'm currently using ASP.NET 3.5 with IIS 5.1 and 6, but will soon be
migratign everything to IIS 7.

Thanks.

Report this message

#2: Re: Retrieving IIS Web Site Property Value during Application_Start

Posted on 2008-04-19 06:49:20 by David Wang

On Apr 18, 3:36=A0pm, "Jordan S." <A...@B.com> wrote:
> How would it be possible for an ASP.NET Web application, in it's
> Application_Start event procedure, to programmatically determine the Web
> site (in IIS) that the Web app is running under/for.
>
> Say for example, that I have a Web site defined in IIS, with the
> "Application name" property set to the value "MyWebApp". =A0How could I ge=
t
> the value "MyWebApp" into a string variable in Application_Start of the
> ASP.NET Web application?
>
> Please note that I'd like to get this value directly from IIS, and not hav=
e
> to manually duplicate it in Web.config.
>
> I'm currently using ASP.NET 3.5 with IIS 5.1 and 6, but will soon be
> migratign everything to IIS 7.
>
> Thanks.


That value is stored in the Metabase. You should be able to use ADSI
or WMI to retrieve that value from the IIS Metabase.

However, IIS7 does not install with metabase support because it is
legacy. Instead, there is a new configuration store and schema that
maps onto ASP.Net .config files. What is used as identifier for a
website changes as well (though legacy interop layer tries to hide
some details).

In short, what are you trying to do?


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Report this message

#3: Re: Retrieving IIS Web Site Property Value during Application_Start

Posted on 2008-04-19 06:49:20 by David Wang

On Apr 18, 3:36=A0pm, "Jordan S." <A...@B.com> wrote:
> How would it be possible for an ASP.NET Web application, in it's
> Application_Start event procedure, to programmatically determine the Web
> site (in IIS) that the Web app is running under/for.
>
> Say for example, that I have a Web site defined in IIS, with the
> "Application name" property set to the value "MyWebApp". =A0How could I ge=
t
> the value "MyWebApp" into a string variable in Application_Start of the
> ASP.NET Web application?
>
> Please note that I'd like to get this value directly from IIS, and not hav=
e
> to manually duplicate it in Web.config.
>
> I'm currently using ASP.NET 3.5 with IIS 5.1 and 6, but will soon be
> migratign everything to IIS 7.
>
> Thanks.


That value is stored in the Metabase. You should be able to use ADSI
or WMI to retrieve that value from the IIS Metabase.

However, IIS7 does not install with metabase support because it is
legacy. Instead, there is a new configuration store and schema that
maps onto ASP.Net .config files. What is used as identifier for a
website changes as well (though legacy interop layer tries to hide
some details).

In short, what are you trying to do?


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Report this message

#4: Re: Retrieving IIS Web Site Property Value during Application_Start in ASP.NET Web app.

Posted on 2008-04-19 19:05:28 by Premium Plastics

request.serverVariables("SERVER_SOFTWARE")

"David Wang" <w3.4you@gmail.com> wrote in message
news:233d62e8-74d5-4dcb-9e17-3813ad534c2c@v23g2000pro.google groups.com...
On Apr 18, 3:36 pm, "Jordan S." <A...@B.com> wrote:
> How would it be possible for an ASP.NET Web application, in it's
> Application_Start event procedure, to programmatically determine the Web
> site (in IIS) that the Web app is running under/for.
>
> Say for example, that I have a Web site defined in IIS, with the
> "Application name" property set to the value "MyWebApp". How could I get
> the value "MyWebApp" into a string variable in Application_Start of the
> ASP.NET Web application?
>
> Please note that I'd like to get this value directly from IIS, and not
> have
> to manually duplicate it in Web.config.
>
> I'm currently using ASP.NET 3.5 with IIS 5.1 and 6, but will soon be
> migratign everything to IIS 7.
>
> Thanks.


That value is stored in the Metabase. You should be able to use ADSI
or WMI to retrieve that value from the IIS Metabase.

However, IIS7 does not install with metabase support because it is
legacy. Instead, there is a new configuration store and schema that
maps onto ASP.Net .config files. What is used as identifier for a
website changes as well (though legacy interop layer tries to hide
some details).

In short, what are you trying to do?


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Report this message

#5: Re: Retrieving IIS Web Site Property Value during Application_Start in ASP.NET Web app.

Posted on 2008-04-19 19:05:28 by Premium Plastics

request.serverVariables("SERVER_SOFTWARE")

"David Wang" <w3.4you@gmail.com> wrote in message
news:233d62e8-74d5-4dcb-9e17-3813ad534c2c@v23g2000pro.google groups.com...
On Apr 18, 3:36 pm, "Jordan S." <A...@B.com> wrote:
> How would it be possible for an ASP.NET Web application, in it's
> Application_Start event procedure, to programmatically determine the Web
> site (in IIS) that the Web app is running under/for.
>
> Say for example, that I have a Web site defined in IIS, with the
> "Application name" property set to the value "MyWebApp". How could I get
> the value "MyWebApp" into a string variable in Application_Start of the
> ASP.NET Web application?
>
> Please note that I'd like to get this value directly from IIS, and not
> have
> to manually duplicate it in Web.config.
>
> I'm currently using ASP.NET 3.5 with IIS 5.1 and 6, but will soon be
> migratign everything to IIS 7.
>
> Thanks.


That value is stored in the Metabase. You should be able to use ADSI
or WMI to retrieve that value from the IIS Metabase.

However, IIS7 does not install with metabase support because it is
legacy. Instead, there is a new configuration store and schema that
maps onto ASP.Net .config files. What is used as identifier for a
website changes as well (though legacy interop layer tries to hide
some details).

In short, what are you trying to do?


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Report this message

#6: Re: Retrieving IIS Web Site Property Value during Application_Start in ASP.NET Web app.

Posted on 2008-04-19 19:54:42 by nomailreplies

re:
!> request.serverVariables("SERVER_SOFTWARE")

Sorry. That returns the IIS version.

The correct answer, in any ASP.NET page, is...

Dim appname as string = Request.ApplicationPath.Substring(1, Request.ApplicationPath.Length-1)
apppath.text = "The application's name is : " & appname

This code assumes you have a texbox named apppath.

You can also use, in global.asax's Application_Start :

Dim MyArray() As String = Split(AppDomain.CurrentDomain.DynamicDirectory, "\")
Application("APP_VIRTUAL_DIR") = (MyArray(6).ToString())

....and, in the page :

Dim AppVirtualDir as string = Application("APP_VIRTUAL_DIR")
apppath.text = AppVirtualDir

This code assumes you have a texbox named apppath.
You can use the AppVirtualDir variable as you see fit.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"ThatsIT.net.au" <me@work> wrote in message news:2CAA9442-7EFB-4299-B1E9-C8A2C5E9334C@microsoft.com...
> request.serverVariables("SERVER_SOFTWARE")
>
> "David Wang" <w3.4you@gmail.com> wrote in message
> news:233d62e8-74d5-4dcb-9e17-3813ad534c2c@v23g2000pro.google groups.com...
> On Apr 18, 3:36 pm, "Jordan S." <A...@B.com> wrote:
>> How would it be possible for an ASP.NET Web application, in it's
>> Application_Start event procedure, to programmatically determine the Web
>> site (in IIS) that the Web app is running under/for.
>>
>> Say for example, that I have a Web site defined in IIS, with the
>> "Application name" property set to the value "MyWebApp". How could I get
>> the value "MyWebApp" into a string variable in Application_Start of the
>> ASP.NET Web application?
>>
>> Please note that I'd like to get this value directly from IIS, and not have
>> to manually duplicate it in Web.config.
>>
>> I'm currently using ASP.NET 3.5 with IIS 5.1 and 6, but will soon be
>> migratign everything to IIS 7.
>>
>> Thanks.
>
>
> That value is stored in the Metabase. You should be able to use ADSI
> or WMI to retrieve that value from the IIS Metabase.
>
> However, IIS7 does not install with metabase support because it is
> legacy. Instead, there is a new configuration store and schema that
> maps onto ASP.Net .config files. What is used as identifier for a
> website changes as well (though legacy interop layer tries to hide
> some details).
>
> In short, what are you trying to do?
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //

Report this message

#7: Re: Retrieving IIS Web Site Property Value during Application_Start in ASP.NET Web app.

Posted on 2008-04-19 19:54:42 by nomailreplies

re:
!> request.serverVariables("SERVER_SOFTWARE")

Sorry. That returns the IIS version.

The correct answer, in any ASP.NET page, is...

Dim appname as string = Request.ApplicationPath.Substring(1, Request.ApplicationPath.Length-1)
apppath.text = "The application's name is : " & appname

This code assumes you have a texbox named apppath.

You can also use, in global.asax's Application_Start :

Dim MyArray() As String = Split(AppDomain.CurrentDomain.DynamicDirectory, "\")
Application("APP_VIRTUAL_DIR") = (MyArray(6).ToString())

....and, in the page :

Dim AppVirtualDir as string = Application("APP_VIRTUAL_DIR")
apppath.text = AppVirtualDir

This code assumes you have a texbox named apppath.
You can use the AppVirtualDir variable as you see fit.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"ThatsIT.net.au" <me@work> wrote in message news:2CAA9442-7EFB-4299-B1E9-C8A2C5E9334C@microsoft.com...
> request.serverVariables("SERVER_SOFTWARE")
>
> "David Wang" <w3.4you@gmail.com> wrote in message
> news:233d62e8-74d5-4dcb-9e17-3813ad534c2c@v23g2000pro.google groups.com...
> On Apr 18, 3:36 pm, "Jordan S." <A...@B.com> wrote:
>> How would it be possible for an ASP.NET Web application, in it's
>> Application_Start event procedure, to programmatically determine the Web
>> site (in IIS) that the Web app is running under/for.
>>
>> Say for example, that I have a Web site defined in IIS, with the
>> "Application name" property set to the value "MyWebApp". How could I get
>> the value "MyWebApp" into a string variable in Application_Start of the
>> ASP.NET Web application?
>>
>> Please note that I'd like to get this value directly from IIS, and not have
>> to manually duplicate it in Web.config.
>>
>> I'm currently using ASP.NET 3.5 with IIS 5.1 and 6, but will soon be
>> migratign everything to IIS 7.
>>
>> Thanks.
>
>
> That value is stored in the Metabase. You should be able to use ADSI
> or WMI to retrieve that value from the IIS Metabase.
>
> However, IIS7 does not install with metabase support because it is
> legacy. Instead, there is a new configuration store and schema that
> maps onto ASP.Net .config files. What is used as identifier for a
> website changes as well (though legacy interop layer tries to hide
> some details).
>
> In short, what are you trying to do?
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //

Report this message