Asp.Net MVC: The name 'ViewBag' does not exist in the current context

alattin (16999) 10 yıl önce sordu

Asp.Net MVC 4 uygulaması local bilgisayarsa çalışırken sayfaları publish edip sunucuya gönderdiğimde 

The name 'ViewBag' does not exist in the current context hatası alıyorum.

Hatanın tamamı şu şekilde:


Server Error in '/' Application.
--------------------------------------------------------------------------------


 Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0103: The name 'ViewBag' does not exist in the current context

 Source Error:

Toplam 2 cevap


alattin (16999) 10 yıl önce cevapladı

Sunucuyu doğru şekilde yapılandırdıysanız

Asp.Net MVC: The name 'ViewBag' does not exist in the current context hatası almanızın nedeni Views klasörünün altındaki web.config dosyasını sunucuya yüklememiş olabilirsiniz.

Asp.Net MVC'de Views klasörü altında web.config dosyası yoksa The name 'ViewBag' does not exist in the current context hatası alınacaktır.

 

ramco123 (1) 3 yıl önce cevapladı

ömrümde ilk defa bi forum sayfasına yorum atıyorum kardeşim helal olsun problemi 2 gündür çözemiyordum gözümden kaçmış orayı nasıl değiştirdiysem artık @alattin

alattin 3 yıl önce

işine yaramasına sevindim. 6 yıl geçmiş. Vakit ayırıp yorum yaptığın için teşekkür ederim.