IIS 更新ScriptMa_WIN2003服务器维护_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

IIS 更新ScriptMa

作者:黑客防线网安linux教程网 来源:黑客防线网安linux教程网 浏览次数:0

本篇关键词:更新s"cript
黑客防线网安网讯:A zip file with your code and stylesheet is also available for download. Make sure you right click on the link and choose Save Target As...To use the colored code in your pages...
A zip file with your code and stylesheet is also available for download. Make sure you right click on the link and choose Save Target As...

To use the colored code in your pages link to the stylesheet colorcode.c and copy everything between the <re cla=''coloredcode''>...</pre> tags. Feel free to modify color aignment in the stylesheet as you wish.


--------------------------------------------------------------------------------

//**************************************
// for :Dynamic scriptMaing with Metabase
//**************************************
Copyright (c) 2003, Lewis Moten. All rights reserved.
//**************************************
// Name: Dynamic scriptMaing with Metabase
// Description:Allows you to aign almost any exteion to be proceed by the AX script proceor. You may add, update, and remove the exteion progromatically without opening the IIS Manager. Great for those of you who do not have acce to the machines desktop (such as hosted at other I).
// By: Lewis E. Moten III
//
//
// Iuts:None
//
// Retur:None
//
//Aumes:None
//
//Side Effects:None
//This code is copyrighted and has limited warranties.
//Please see http://www.Planet-Source-Code.com/xq/A/txtCodeId.1586/lngWId.10/qx/vb/scripts/ShowCode.htm
//for details.
//**************************************

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ext As String = "GIF"
'' Setup exteion to be proceed by AX script proceor
Reoe.Write("amltR>Add: " &am Maing(ext, MaingAction.Add))
'' Update exteion to be proceed by latest AX script proceor
Reoe.Write("amltR>Update: " &am Maing(ext, MaingAction.Update))
'' Setup exteion so that it is not proceed by any script proceor
Reoe.Write("amltR>Delete: " &am Maing(ext, MaingAction.Delete))
End Sub
Enum MaingAction
Add
Update
Delete
End Enum
Private Function Maing(ByVal ext As String, ByVal action As MaingAction) As Boolean
'' Aig the AX proceor to the exteion ecified.
'' See IIS documentation for information regarding script maing
'' http://localhost/iishelp/iis/htm/a/apro9tkj.htm
'' Example of script Maing:
'' ".gif,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aet_isapi.dll,1,GET,HEAD,POST,DEBUG"
Dim AL_MD_PATH As String
Dim Aath As String
Dim A As DirectoryEntry
Dim scriptMa As ArrayList
Dim ExtentionExists As Boolean = False
Dim scriptProceor As String = "quot;
Dim Flags As String = "5"
Dim IncludedVer As String = "GET,POST,HEAD"
Dim NewMap As String = "#123;0},{1},{2},{3}quot;
'' Make sure ext is prefixed with "."
If Not ext.IndexOf(".") = 0 Then ext = "." &am ext
'' Make sure ext is lowercase
ext = ext.ToLower
'' Do our best to prevent problems with default script proceors
Dim BadExt As String
BadExt = ".asa.asax.ascx.ashx.asmx.a.ax.asd.cdx.cer.config."
BadExt &am= "cs.croj.idc.java.jsl.licx.rem.resources.resx.shtm."
BadExt &am= "html.soap.stm.vb.vroj.vjroj.vsdisco.webinfo."
If Not BadExt.IndexOf(ext &am ".") = -1 Then
Return False
End If
Reoe.Write("got here!")
Reoe.End()
'' Get alication metadata path
AL_MD_PATH = Request.ServerVariables("AL_MD_PATH").ToString
'' Format path for ADSI
Aath = Replace(AL_MD_PATH, "/LM/", "IIS://localhost/")
'' Attempt to acquire the object
Try
If DirectoryEntry.Exists(Aath) Then
A = New DirectoryEntry(Aath)
End If
Catch ex As Exception
Return False
End Try
'' Get a list of all script maings
scriptMa = New ArrayList(CType(A.Properties("#115;criptMaquot;).Value, Object()))
'' If we are not deleting a script map
If Not action = MaingAction.Delete Then
'' We need to get the latest proceor italled
'' that handles ax pages.
For Each Map As String In scriptMa
'' if the first value of the string is an AX page
If lit(Map, ",", 4)(0) = ".ax" Then
'' The latest script proceor is the second
'' value in the comma delimited string
scriptProceor = lit(Map, ",", 4)(1)
Exit For
End If
Next
'' Proceor not found!
If scriptProceor = "quot; Then
A.Diose()
A = Nothing
Return False
End If
End If
'' Find out if exteion exists
For index As Integer = 0 To scriptMa.Count() - 1
'' get current map
Dim map As String = scriptMa(index).ToString
'' if we found the exteion
If lit(Map, ",", 4)(0) = ext Then
'' Determine results based on action
If action = MaingAction.Add Then
'' impoible to add if it exists
A.Diose()
A = Nothing
Return False
ElseIf action = MaingAction.Update Then
'' update the map with latest script proceor
scriptMa(index) = NewMap.Format(NewMap, ext, scriptProceor, Flags, IncludedVer)
Exit For
ElseIf action = MaingAction.Delete Then
'' delete the map
scriptMa.RemoveAt(index)
Exit For
End If
End If
Next
'' Is user attempting to add map?
If action = MaingAction.Add Then
'' Build the new map
scriptMa.Add(NewMap.Format(NewMap, ext, scriptProceor, Flags, IncludedVer))
End If
'' Save the new set of script ma
A.Properties("#115;criptMaquot;).Value = scriptMa.ToArray
A.CommitChanges()
A.Diose()
A = Nothing
Return True
End Function

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-19284-1.html
网站维护教程更新时间:2012-12-08 13:53:59  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer