Click here to Skip to main content
15,891,910 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I am using a @Html.Actionlink(..) callo to redirect my page to a specific action in a controller .
My call is the following :

@Html.ActionLink(P.Cert,  "RedirectToRate","Panels", new { @sede = P.Sed1 + P.Sed2, @catg = P.Catg, @cert = P.Cert,  @anno = P.AnnoValidita }, new { @style = "background-color : white ;width :70% " })


I can see that it's rendered as :

<a href="/Panels/RedirectToRate?sede=0100&catg=885&cert=01030580" style="background-color : white ;width :70% ">01030580</a>


which is what I want.
in the "Panels" controller I have the "RedirectToRate" action whose contract is as follows :

ActionResult RedirectToRate(string sede="", string catg="", string cert="", string anno="")


my route maps are the following

routes.MapRoute(
               name: "Default",
               url: "{controller}/{action}/{id}",
               defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
           );

         routes.MapRoute(
               name: "Access",
               url: "{controller}/{action}/{pensione}/{sede}/{catg}/{cert}/{anno}",
               defaults: new { controller = "Home", action = "Index",  sede = UrlParameter.Optional, catg = UrlParameter.Optional, cert = UrlParameter.Optional, anno = UrlParameter.Optional }
           );





When I click the link, I have a runtime error, I don't know how and where, so that i am not able to catch it .... any idea why ?
thanks

What I have tried:

changing route mapping

reversing Controller/Action order in the actionlink call
Posted
Comments
F-ES Sitecore 12-Jan-18 6:21am    
You don't think the text of the error is relevant to someone being able to help you? Do you phone a mechanic and say "there's a warning light on my dashboard, what's the problem?" without saying which light is on?

Regardless, you don't need to modify the routes to do what you want to do so just remove your "Access" route. And if you get an error message always say what the error message is and what line it appears on.
tiwal 12-Jan-18 7:19am    
If I had any kind of error message, you can bet I would have reported it..
The problem is, the application is unable to trap any exception , so the
"customErrors" tag of the web.config comes into play and shows me the default error page ...
F-ES Sitecore 12-Jan-18 7:31am    
Amend the web.cofig file to show the error then.
tiwal 12-Jan-18 7:46am    
System.Exception :
_COMPlusExceptionCode = -532462766
F-ES Sitecore 12-Jan-18 8:45am    
That doesn't have anything to do with the code you posted or the original question. You'll need to do more debugging to find out exactly what is causing the issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900