views:

32

answers:

1

Hi I am trying to add additional parameter in my route

 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

                routes.MapRoute(
                  "CustomRoute",
                  "{controller}.mvc/{action}/{id}/{recid}",
                  new { action = "Index", id = "", recid = UrlParameter.Optional }
                );            

            routes.MapRoute(
              "Root",
              "",
              new { controller = "Account", action = "Index", id = "", recid = 

UrlParameter.Optional
);

The pages with /controller/action/id are rendered correctly, but when i call page with /controller/action/id/recid i am not getting correct values in RouteData.Values in the following funcion. RouteData.Values has correct value initially. but after that function call itself again and RouteData.Values has three values rather than four and it has prompt.js in id field

protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            var RouteValue = requestContext.RouteData.Values;
            String p = RouteValue.ToString();
            this._DocumentID = String.IsNullOrEmpty(RouteValue["id"].ToString()) ? 2 : Convert.ToInt32(RouteValue["id"]);
            FormsIdentity ident = User.Identity as FormsIdentity;
            if (ident != null)
            { 
                FormsAuthenticationTicket ticket = ident.Ticket;
                UserData = ticket.UserData;
                this._UserID = Convert.ToInt32(UserData.Split('|')[0]);
                this._RoleID = Convert.ToInt32(UserData.Split('|')[1]);
                this._EmployeeID = Convert.ToInt32(UserData.Split('|')[2]);
            }
        }
A: 

The page you render contains a ressource prompt.js in it. Remove this file or change routing to ignore requests that end with .js.

Malcolm Frexner
But if i render the same page with {controller}.mvc/{action}/{id} and use the recid as query string parameter every thing works fine
Tassadaque