开发者

How to read AspMaxRequestEntityAllowed from asp code

In order to change the maximum upload size in IIS, the user can adjust in the IIS metabase the AspMaxRequestEntityAllowed value as explained in different sites.

My question is:

Is it possible to read the current maximum allowed size for uploads from classic Asp code?

Explanation: I'm adjusting some upload code, and one feature now is to notify the client side of the maximum upload size so that files sent with Flash or FormData can be validated and not even try to send them if they are t开发者_开发百科oo large and the upload would fail. So I can either hope that when the users configure it, correctly write in the configuration file the maximum allowed by their server; but it would be much better if I can get the real value from IIS.


You can use WMI to do that. For instance, using VBScript:

Dim provider, setting, maxUploadSize
Set provider = GetObject("winmgmts:/root/MicrosoftIISv2")
Set setting = provider.Get("IIsWebVirtualDirSetting='W3SVC/1/ROOT'")
maxUploadSize = setting.AspMaxRequestEntityAllowed
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜