Abdulmajeed Alshari

Abdulmajeed Alshari

  • 1.4k
  • 266
  • 57k

Server Error in '/' Application this problem not show before

Oct 5 2018 8:50 AM

This Error Message as the below :

The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /controlPanel/deleteBackup/8595db89-b019-41c2-83bb-ef2b45ffd92d

and this is Html code
  1. <a href='@Url.Action("deleteBackup", "controlPanel", new { id = item.ID })' class="btn btn-danger">Delete</a>  

too I try this way

  1. @Html.ActionLink("Delete", "deleteBackup", new { id = item.ID }, new { @class = "btn btn-danger" })  
why I use like the below code in other controller and other view , It well run as:
  1. <a href='@Url.Action("aboutMember", "Members", new { memberId = Model.TrainerMembers[i].memberId })'>  

Note : deleteBackup Action is in the Same controller for that I not write controller Name in ActionLink

codes at the Controller as the below :

  1. [HttpPost]  
  2. public ActionResult deleteBackup(string id)  
  3. {  
  4. if (id!=null)  
  5. {  
  6. db.Backups.Remove(db.Backups.Find(id));  
  7. db.SaveChanges();  
  8. }  
  9. return RedirectToAction("BackUpSetting");  
  10. }  
 
and this RouteConfig class as :
 
 
 
  1. public class RouteConfig  
  2.         {  
  3.         public static void RegisterRoutes(RouteCollection routes)  
  4.         {  
  5.             routes.IgnoreRoute("{resource}.axd/{*pathInfo}");  
  6.   
  7.             routes.MapRoute(  
  8.                 name: "Default",  
  9.                 url: "{controller}/{action}/{id}",  
  10.                 defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }  
  11.             );  
  12.         }  
  13.         }  
Note : this action is Authenticated For the Current User

Why was it working before? But why now is this wrong?

Thanks in advance

 

Answers (1)