PDA

View Full Version : تشخیص پارامترهای Web.config



spicirmkh
یک شنبه 18 اردیبهشت 1390, 13:32 عصر
با سلام

در زبان #C چطور می شود فهمید که در web.config مقدار authentication mode="Windows" یا Forms

با تشکر

clover
دوشنبه 19 اردیبهشت 1390, 00:15 صبح
سلام


using System.Configuration;
using System.Web.Configuration;


Configuration webConfig = WebConfigurationManager.OpenWebConfiguration("/");
AuthenticationMode authenticationMode = (webConfig.GetSection("system.web/authentication") as AuthenticationSection).Mode;

موفق باشید

spicirmkh
یک شنبه 01 خرداد 1390, 21:07 عصر
سلام

یک اتفاق جالب و عجیب

من طبق دستور زیر روی سرور محلی مقدار FORMS را دریافت می کنم



Configuration webConfig = WebConfigurationManager.OpenWebConfiguration("/");
AuthenticationMode authenticationMode = (webConfig.GetSection("system.web/authentication") as AuthenticationSection).Mode;
lbtHelp.Text = authenticationMode.ToString().ToUpper();



اما با IP معتبر که از بیرون به سرور وصل می شویم مقدار Windows بر می گرداند

با تشکر