'da CustomErrors özelliğini açık konuma getirme Web uygulama çalışma zamanında kodda hava durumu özel hatalarının açık veya kapalı olduğunu kontrol etmek mümkün müdür?Code
Q
Code
8
A
cevap
13
.. .
HttpContext.Current.IsCustomErrorEnabled
3
Sen özel hata engellemek almak için kullanabilirsiniz sonra, web sitesi için yapılandırmayı elde etmek WebConfigurationManager.OpenWebConfiguration kullanabilirsiniz: Ben İçinde nasıl anladım
Configuration configuration =
WebConfigurationManager.OpenWebConfiguration(null);
CustomErrorsSection customErrorsSection =
configuration.GetSection("system.web/customErrors") as CustomErrorsSection;
Response.Write(customErrorsSection.Mode.ToString());
0
OpenWebConfiguration (doğru) (null) veya HttpContext.Current.IsCustomErrorEnabled, bana yanlış bilgi verdi Bu ancak büyük Kopya macunu çalıştı:
public static CustomErrorsMode GetRedirectMode()
{
Configuration config = WebConfigurationManager.OpenWebConfiguration("/");
return ((CustomErrorsSection)config.GetSection("system.web/customErrors")).Mode;
}
İlgili konular
- 1. VS Code
- 2. Xamarin.Forms, Code
- 3. Android, Code
- 4. Google Code
- 5. VS Code
- 6. VS Code
- 7. nasıl <code>initialize</code> içine <code>define_method</code> kullanmaya çalışıyor ama undefined_method <code>define_method</code> alma()
- 8. EF7 Ben <code>UWP</code> uygulamada, <code>SQLite</code> ile <code>EF7</code> kullanıyorum veritabanını
- 9. Ben <code>CellEditor</code> ve <code>CellRenderer</code> kullanarak <code>JTable</code> içine <code>JRadioButton</code> eklemeye çalıştı JTable
- 10. Eğer <code>Button</code>, <code>ProgressBar</code> ve <code>EditText</code> bileşenlerin <code>TableLayout</code> değişiklikler genişliğini görebileceğiniz gibi TableLayout
- 11. doğru benim <code>CustomModule</code> için <code>FromGroup</code>, <code>FormBuilder</code> ve <code>FormControl</code> almayı deneyin Eğik 2
- 12. , ben <code>mongo</code> için yeni ve <code>bson files</code> altına <code>restore/import</code> çalışırken sürüm <code>3.0.6</code> Mongo için
- 13. Linq:</p> <p><code>Company</code>, <code>Invoice</code> ve ondalık özelliği <code>Price</code> sahiptir <code>InvoiceLine</code>: toplamlar
- 14. Rails'in .Where() nitelik ı <code>current_revision</code> ile <code>SectionRevision</code> ile ilişkilidir birçok <code>Section</code> modelleri içeren <code>Page</code> modele sahip
- 15. Matlab: For döngüsü bir bütün <code>*fun</code> fonksiyonları (<code>arrayfun</code>, <code>cellfun</code>, <code>structfun</code> ve <code>spfun</code>) veya basitçe <code>for</code> döngü kullanarak kullanarak daha iyidir
- 16. Python ben dizindeki <code>foo</code> dosya <code>foo_file.txt</code> ile, bir dizin <code>foo</code> içinde bir dizin <code>bar</code> varsa ve dizinde <code>bar</code> yılında <code>bar_file.txt</code> dosya
- 17. um Vim <code>is</code> için <code>is</code> den Python'la
- 18. OnItemSelectedListener.onNothingSelected çağrıldı mı? <code>onItemSelected</code> ve <code>onNothingSelected</code>:
- 19. iphone taşma <code>Fancybox</code><code>iPhone's Safari browser</code> açıldığında
- 20. ben <code>evaluate</code> içinde <code>console.log</code> kullandığınızda, çalışıyor Neden setTimeout
- 21. Ben iki işlevi <code>f</code> ve <code>g</code> sahip C++
- 22. tipi 'T' <code>Concrete</code><code>Base</code> türeyen tip
- 23. Ben <code>windows</code> içinde <code>sox</code> yüklediğim
- 24. nasıl excel dosyasından <code>DataSet</code> ayıklamak için <code>OleDbDataAdapter</code> kullanıyorum
- 25. ben kendi <code>IPrincipal</code> ve <code>IIdentity</code> uygulanmasını oluşturmak MVC3
- 26. Bir <code>LinearLayoutManager</code> ile <code>RecyclerView</code> var
- 27. strcpy'nin bir <code>char *</code><code>String</code> adı sahip yanlış formu
- 28. fread ben <code>data.table</code> paketinden <code>fread</code> kullanmış;
- 29. Uyarı <code>VIM</code> yılında <code>conque</code> çalıştırırken VIM
- 30. rdply ve .kimlik argüman <code>plyr</code> pakette <code>rdply</code> için
'OpenWebConfiguration (null)' mevcut uygulamada web.config ama makinede yüklü web.config yüklemek için görünmüyor. Diğer cevaplar 'OpenWebConfiguration (" ~ ")' dır ancak doğrulamamışımdır. – Buildstarted