Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,
i have implemented routecollection in asp.net using global.asax.
the problem is that if my current url is localhost:0000/task and i click on anchor tag
HTML
<a href="CreateTask" class='navlink'>Create Task</a>

then it is working fine..but if url can be like localhost:0000/task/23 when i am adding querystring in global.asax. In my case, it will take 23 as taskid and will show related records to id 23. But in this case it is still on the same page.
Here my url is localhost:0000/task/23

Suppose I want to navigate to another page named as team then after clicking on the same the link in address bar should be localhost:0000/team

but in my case it displays link in address bar : localhost:0000/task/team

and it doesnt redirect anywhere because it is creating incorrect link as above

So my question is how can i redirect it to :localhost:0000/team

The MapRoute is like

C#
routecollection.MapPageRoute("CreateTask", "CreateTask", "~/View/CreateTask.aspx");
routecollection.MapPageRoute("TaskProfile", "TaskProfile/{taskid}", "~/View/TaskProfile.aspx");


how to solve this issue..
Posted
Updated 11-Jan-15 20:52pm
v4
Comments
Kornfeld Eliyahu Peter 11-Jan-15 9:12am    
Can you share with us the routing from global.asax?
m-shraddha 11-Jan-15 23:36pm    
routecollection.MapPageRoute("CreateTask", "CreateTask", "~/View/CreateTask.aspx");
routecollection.MapPageRoute("TaskProfile", "TaskProfile/{taskid}", "~/View/TaskProfile.aspx");
Kornfeld Eliyahu Peter 12-Jan-15 2:16am    
I can't see how your URLs in the question
localhost:0000/task
localhost:0000/task/23
are related to these mappings...Something isn't clear here...
m-shraddha 12-Jan-15 2:48am    
Please see the updated question
m-shraddha 11-Jan-15 9:14am    
routecollection.MapPageRoute("CreateTask", "CreateTask", "~/View/CreateTask.aspx");
routecollection.MapPageRoute("TaskProfile", "TaskProfile/{taskid}", "~/View/TaskProfile.aspx");

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