London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Routing problem or? Works in epi 10 but not in epi 7

Vote:
0
I have a solution that works in Episerver 10 but it doesnt work in Episerver 7. We have a customer who wants his solution in Episerver 7.
I have a controller with the name DigitalanslagstavlaPageController. This controller has two action. Index och GetDocument.
Index list information in the html view. GetDocument read a document from a webservice.
I get a list from action Index. It works.
I create a link to a document with
It creates a link that looks like this http://localhost:37008/DBB7Page/GetDocument/?Id=517
I have tried to add the controller name to Url.Action. But it doesent work. Same error
When i press the link i want to get the document from the webservice and go to a html view that show this document

This work in Episerver 10, but not in Episerver 7.
I get
Server Error ‘/’ Application
Content with id 517 was not found
*
*
You have the stack trace last
I know that the document with id exist in the database. I know that my back-end code works to.

I think it is a routing problem. Can anyone give me tips on how to solve the problem
This is my controller
public class DigitalanslagstavlaPageController : PageController
{
    [HttpGet]
    public ActionResult Index(DigitalanslagstavlaPage currentPage)
    {
      /*  CODE THAT DO STUFF */
     return View(currentPage);
    }
    [HttpGet]
    public ActionResult GetDocument(DigitalanslagstavlaPage currentPage, int? Id)
    {
           /*  CODE THAT DO STUFF */
        return View(currentPage);
    }
}

My MVC routing is
    public class EPiServerApplication : EPiServer.Global
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
        }
        protected override void RegisterRoutes(RouteCollection routes)
        {
            base.RegisterRoutes(routes);
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
              "Default",
              "{controller}/{action}/{id}",
              defaults: new { controller = "DigitalanslagstavlaPage", action = "Index", id = UrlParameter.Optional });
        }
    }
STACK TRACE:
[ContentNotFoundException: Content with id 517 was not found]
   EPiServer.DataAccess.ContentDB.ThrowNotFoundException(ContentReference contentLink) +135
   EPiServer.DataAccess.ContentLoadDB.LoadContentInternal(ContentReference contentLink, Int32 languageBranchId, DbDataReader reader) +306
   EPiServer.DataAccess.<>c__DisplayClass1.b__0() +328
   EPiServer.Data.Providers.<>c__DisplayClass1`1.b__0() +87
   EPiServer.Data.Providers.SqlDeadlockRetryPolicy.Execute(Boolean isInTransaction, Func`1 method) +142
   EPiServer.Data.Providers.SqlDatabaseHandler.Execute(Func`1 action) +303
   EPiServer.DataAccess.ContentLoadDB.Load(ContentReference contentLink, Int32 languageBranchID) +286
   EPiServer.DataAbstraction.ContentStore.Load(ContentReference contentLink, Int32 languageBranchID) +67
   EPiServer.DefaultContentProvider.LoadContent(ContentReference contentLink, ILanguageSelector languageSelector) +562
   EPiServer.Core.<>c__DisplayClassf.b__d() +190
   EPiServer.Core.OptimisticCache`1.Read(String cacheKey, ReadAndCacheObject`1 readAndCacheObject) +794
   EPiServer.Core.ContentProvider.LoadContentFromCacheOrRepository(ContentReference contentreference, ILanguageSelector selector) +1088
   EPiServer.Core.ContentProvider.Load(ContentReference contentLink, ILanguageSelector selector) +75
   EPiServer.DataFactory.Get(ContentReference contentLink, ILanguageSelector languageSelector) +395
   EPiServer.DataFactory.Get(ContentReference contentLink) +168
   EPiServer.Web.Mvc.ExistingActionRouteConstraint.Match(HttpContextBase httpContext, Route route, String parameterName, RouteValueDictionary values, RouteDirection routeDirection) +265
   EPiServer.Web.Routing.ContentRoute.MatchConstraints(SegmentContext segmentContext, HttpContextBase context) +650
   EPiServer.Web.Routing.ContentRoute.GetRouteData(HttpContextBase httpContext) +670
   System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +235
   EPiServer.Web.Routing.RouteCollectionExtensions.HandleRouteData(RouteCollection routes, HttpContextBase context) +68
   EPiServer.Global.DefaultDocumentHandling(Object sender, EventArgs e) +215
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
#182839
Sep 29, 2017 9:55
Vote:
0

"id" can be considered reserved by Epi packaged code. Try calling the paramater something else.

#182977
Oct 02, 2017 22:19
Vote:
0

This was the problem.

Tnx Johan

#183032
Oct 03, 2017 16:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.