Click here to Skip to main content
15,900,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
friends ,I am very new in MVC,
i Found
http://demo.nopcommerce.com/25-virtual-gift-card[^]

http://demo.nopcommerce.com/customer-service-client-service[^]

http://demo.nopcommerce.com/electronics[^]

in nop commerce demo site,and I am confused how they create a url without {controller}/{action}?

How to create and use multiple/various Route in Global.asax.

in asp.net web project we use session for storing user id after user login,in MVC how to do that.

please write or give some reference so that i an enhance my knowledge.

thanks in advance
Posted
Comments
[no name] 4-Sep-13 13:02pm    
Your reference is http://www.nopcommerce.com/documentation.aspx
KuntalBose 4-Sep-13 13:03pm    
i go through this link but its not much help me
[no name] 4-Sep-13 13:07pm    
Asking your questions about someone else's product here is not going to help you either. You need to ask people that know about that product and they are the ones that know the most. That is what customer service people get paid to do.... provide customer support.
Jameel VM 4-Sep-13 13:41pm    
he is asking about custom url routing

1 solution

In MVC you can add custom route for example if i have an Controller and ActionResult like below
C#
public class HelloController : Controller
  {
      //
      // GET: /Hello/

      public ActionResult Index()
      {
          return View();
      }


If you want to display the routes as http://localhost:56007/25-virtual-gift-card[^] whenever you browse http://localhost:56007/hello/index You should add custom route like below
C#
public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                "SecondRoute",
                "25-virtual-gift-card",
                new { controller = "Hello", action = "Index" }
                );
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Hello", action = "Index", id = UrlParameter.Optional }
            );
        }


For more custom routes about http://www.asp.net/mvc/tutorials/controllers-and-routing/creating-custom-routes-cs[^]
Hope this helps
 
Share this answer
 
Comments
KuntalBose 5-Sep-13 3:59am    
thankx for reply,this is help full.
but still i have a question in my mind,I think the urls of nopcommerce they use product name as parameter.they pass only the dynamic parameter.is that works if i send only parameter in
in URL section of global.asax.

and what about sessions,please let me know if you have spare time in your work schedule
Jameel VM 8-Sep-13 6:11am    
please post it as a separate question.if this post helpful mark it as answer or upvote..of course CP will help you
Jameel VM 8-Sep-13 6:13am    
I also advice you to research a lot and after the research if you didn't get any useful information post your doubt to CP or any other forum.

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