Does ASP(VBScript) have a function similar to PHP's ini_get?

落爺英雄遲暮 提交于 2019-12-10 11:26:10

问题


I am converting a File Upload PHP script to ASP.

The PHP script gets the post_max_size variable from php.ini with ini_get().

$POST_MAX_SIZE = ini_get('post_max_size');

First, is there a similar file or methodology employed by IIS or .NET. If there is, is there a similar variable that controls the max post size. And assuming both of those are true, is there something similar in ASP(VBScript) that can pull the variable from IIS or .NET?

I am not an ASP developer, so I am at a complete loss. Any help would be appreciated, even helping me ask the correct question if that is the appropriate path to take.


回答1:


No. But there are many providers for achieve to configuration.
PHP's post_max_size equal to ASPmaxRequestEntityAllowed for ASP in the IIS config.
Following sample uses ADSI or WMI provider.
Works if you have permission and provider(s) installed.

Dim INSTANCE_ID : INSTANCE_ID = Request.ServerVariables("INSTANCE_ID")

'ADSI provider
Response.Write GetObject("IIS://localhost/W3SVC/"& INSTANCE_ID &"/Root").ASPmaxRequestEntityAllowed

Response.Write "<hr />"

'WMI provider
Response.Write GetObject("winmgmts:/root/MicrosoftIISv2")._
Get("IIsWebVirtualDirSetting='W3SVC/"& INSTANCE_ID &"/ROOT'").ASPmaxRequestEntityAllowed


来源:https://stackoverflow.com/questions/7436899/does-aspvbscript-have-a-function-similar-to-phps-ini-get

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!