Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedRouting in a moduleRouting in a module
Previous
 
Next
New Post
12/27/2013 9:14 AM
 

Is there a way to build routing into a module so that I can browse to friendly URLs like:

  • /Courses to display a list of courses in the database
  • /Courses/Course-Name/Detail to display the detail for the course with ID 1

If this is possible, how would you go about it?  I've been searching the web for leads, but so far I've found very little.  I have noticed that you can add extra terms to a page's URL with out affecting the page.  Maybe it's just a matter of accessing those terms, but I haven't discovered how yet.

Any help you can provide would be much appreciated. 

 
New Post
12/27/2013 11:57 PM
 
It depends on exactly what you mean - if you mean you want the ability to insert, update, delete and select data by varying the url that is referred to as a REST architecture and you need to do a little work to vary the http verb that the page is called for (i.e. HTTPGET to return data, HTTPPOST/HTTPPUT for create/update etc.) - most people (including DNN) do this via ajax based services (read up on DNN's service framework for some examples). If you simply mean selecting that DNN's url rewriting works in that way i.e. a page with a module on it might have a "real" url of mysite.com/default.aspx?tabid=2&mid=99&reportid=1 but DNN rewrites that by mapping page 99 to a page called "courses", reading back the module name "coursedetails" based on the moduleid of 99 and then rewriting the reportid=1 part in a directory structure(reportid is a variable that your custom module uses to read the report back) - the eventual path that appears in the url would be mysite.com/courses/coursedetails/reportid/1

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
12/30/2013 1:16 PM
 

Thanks for your reply.

Writing a webapi, to me, seems like overkill for such a simple situation.  Let me ask in a more generic way, my example may have misled you.  How would you normally allow a module to accept parameters through the URL?

 
New Post
12/31/2013 9:43 AM
 
You just need to add code into your module to read the parameters i.e. request.querystring (though normally it's a good idea to use request.params to support both get and post requests for the case where your module allows edits)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
1/3/2014 11:29 AM
 

Ah, simple enough.

I'd like to mention that I also stumbled on to ExtensionUrlProvider, which looks like what I for friendly urls.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedRouting in a moduleRouting in a module


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out