PDA

View Full Version : سوال: گرفتن پارامتر درwebconfig



almaswert
چهارشنبه 01 مهر 1388, 11:12 صبح
آیا می توان پارامتر مربوط به
<httpRuntime maxRequestLength="10295" useFullyQualifiedRedirectUrl="true" executionTimeout="14400" appRequestQueueLimit="500"/>
maxRequestLenght را در webconfig گرفت و در صفحه ای دیگر می خواهم از این پارامتر استفاده کنم.

nazaninam
چهارشنبه 01 مهر 1388, 11:45 صبح
بله به صورت زیر :



Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpC ontext.Current.Request.ApplicationPath);
SystemWebSectionGroup webSection = (SystemWebSectionGroup)config.GetSectionGroup("system.web");
int MaxLength = webSection.HttpRuntime.MaxRequestLength;



دقت نمایید که باید فضا نام زیر را اضافه کنید :


using System.Web.Configuration;