shubham upadhyay

shubham upadhyay

  • NA
  • 31
  • 6.5k

my url routing is not performing well:

Jul 7 2020 1:08 PM
my url routing is not performing well:
global.asax:
<%@ Import Namespace="System.Web.Routing" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterCustomRoutes(RouteTable.Routes);
}
public static void RegisterCustomRoutes(RouteCollection routeCollection)
{
routeCollection.MapPageRoute("AllAuthorRoute","author/{letter}","~/AllAuthor.aspx?");
}
index.aspx.cs :
protected void DataList2_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "AuthorAZ")
{
Response.Redirect(GetRouteUrl("AllAuthorRoute", null) + e.CommandArgument.ToString());
}
}
But the problem is does not find right path and got error

Answers (1)