Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the ASP.NET version of the IIS directory

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to modify the ASP.NET version of the IIS directory. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

An ASP.NET version method for modifying virtual directories

ASP.NET IIS Registration tool

Using the ASP.NETIIS Registration tool (Aspnet_regiis.exe), you can easily update the script mapping of an ASP.NET application to point to the ASP.NET version associated with the tool.

For more details on the ASP.NETIIS registration tool, please refer to MSDN.

On the console, we can modify the Asp.Net version of a virtual directory using the following command:

Aspnet_iis.exe-spath

Now that we know how to modify the version of a virtual directory, the problem now is how to use the program to implement it.

The following code is compiled in WindowsXpsp2 based on .NetFrameWork2.0:

/ / create a virtual directory DirectoryEntrydirRoot=newDirectoryEntry ("IIS://localhost/W3SVC/1/Root"); DirectoryEntriesdirs=dirRoot.Children; DirectoryEntryvirtualDir=dirs.Add ("VirtualChange", dirRoot.SchemaClassName); object [] objs=newobject [] {true}; virtualDir.Invoke ("AppCreate", objs); virtualDir.Properties ["AppFriendlyName"] [0] = "VirtualChange"; virtualDir.Properties ["Path"] .value = "C:\\ VirtualChange"; virtualDir.CommitChanges () / / start the aspnet_iis.exe program stringfileName=Environment.GetEnvironmentVariable ("windir") + @ "\ Microsoft.NET\ Framework\ v1.1.4322\ aspnet_regiis.exe"; ProcessStartInfostartInfo=newProcessStartInfo (fileName); / / process the directory path stringpath=virtualDir.Path.ToUpper (); intindex=path.IndexOf ("W3SVC"); pathpath=path.Remove (0quotient index); / / start the aspnet_iis.exe program to refresh the textbook mapping startInfo.Arguments= "- s" + path; startInfo.WindowStyle=ProcessWindowStyle.Hidden; startInfo.UseShellExecute=false StartInfo.CreateNoWindow=true; startInfo.RedirectStandardOutput=true; startInfo.RedirectStandardError=true; Processprocess=newProcess (); process.StartInfo=startInfo; process.Start (); process.WaitForExit (); stringerrors=process.StandardError.ReadToEnd (); if (errorsfilling stringing.empty) thrownewException (errors); Console.WriteLine (process.StandardOutput.ReadToEnd ())

The ASP.NET version of the IIS directory was modified successfully

On "how to modify the ASP.NET version of the IIS directory" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report