问题
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