Custom URL to a user control within my custom module - c#

I am building a module for dot net nuke.
It is similar to a HTML module but with some customizations. The user would add it multiple times on a page. I would like to create a hyperlink that the user can use to view the each one of the modules individually.
I want to add functionality so that a particular module can be displayed with its contents as if it were added to a page.
e.g I add the module 3 times on /News.aspx:
Article1
Article2
Article3
I would like these urls to work (without actually creating those pages(:
/News/Article1UniqueKey
/News/Article2UniqueKey
/News/Article3UniqueKey
The Unique key would be the module ID by default or a string that the user would enter in the edit page for a module.
How do I achieve this.

This could be achieved in a few ways. The most common way is using FriendlyURL provider, such as one for Ifinity's URLMaster. You can find a number of providers available, with source, at http://www.ifinity.com.au though things will change a little bit with DNN 7.1 as URLMaster is being integrated into the product, I believe the providers will just need to be recompiled against DNN 7.1 instead of older versions.

Related

Content of webpage doesn't display in Module in DotnetNuke

I am new in DotnetNuke. So, first of all I don't know all terminology. My problem is content of Webform.aspx doesn't display in Module.
Let me describe the steps so it can be easy to track the missing steps if any.
1- Created a project of DotnetNuke 7 C# Compiled Module. Path:
F:\website\dnndev.me\desktopmodules\DNNModule2
2- Added a WebForm1.aspx and add a line "Hello World"
3- Build project, DNNModule2_00.00.01_Install.zip is generated in
F:\websites\dnndev.me\DesktopModules\DNNModule2\DNNModule2\install
4- Added extension in http://www.dnndev.me/Admin/Extensions. It added
successfully in Modules.
5- Created New Page and added DNNModule2 by drag and drop. But it
doesn't display content "Hello World" of WebForm1.aspx.
Do I need to set any property while I am adding Module in New WebPage?
Also suggest if my flow is wrong. I will be happy to improve.
Thanks
For a DNN module to work properly you need to work with an .ascx user control. Typically these will inherit from the PortalModuleBase class. There are a few options, but that is the most common.
.aspx pages themselves can exist in DNN, however, they are ONLY available if you access them directly, and not through the module process.
Your user control, when setup should be part of the .dnn manifest and referenced with a <controlkey/> value. (As in no control key defined, to be the default view of your module.)
If you are not using a template, this one is a great example.

.net Replace text with username at runtime

I am writing a C# .net website for management use within my company. On this page, I have a location on the main page to hold notices, which are contextually colored information panels. On the options page, you are given the ability to create them by filling out a form containing the notification's title, message, and a drop down for its class.
One of the the options I would like to provide for the users is to use {name} within the message to show the username of the person viewing the notification. I attempted to use message.Replace("{name}", "<asp:LoginName ID=\"LoginName1\" runat=\"server\" />");, but this resulted in that exact string being posted as opposed to the .net parser converting it into the username.
I am using the default asp.net user creation engine and database, though I've also heard that Silverlight is now the standard.
As for my questions, would I be better off rebuilding the project in Silverlight, assuming Silverlight has the capability to handle secure logins? Also, what would be the correct way to go about replacing the username? Would I be better off with something like {user=#} where # is the user's ID? Theoretically, it would just be a database query from within my Notice class (the constructor calling a method that replaces bbcode with its html counterpart).
Thank you for your help
<asp:LoginName ID=\"LoginName1\" runat=\"server\" /> will work only if directly put in the ASPX. If you want to dynamically set the name without using a control, there's two way:
From the page's code-behind, you can call this.User.Identity.Name
From anywhere in the app, you can call HttpContext.Current.User.Identity.Name

Common ASPX pages used by multiple Application

Have a number of applications, which have similar pages.
E.g Payment Page, Search Page etc.
Looking for the best way to design the application so all the applications can use the common pages rather than having 3 versions of the same file.
It was suggested creating an app containing the common pages only where the other apps would transfer to when accessing the webpage and out again when finished. This just seems wrong, or am I incorrect.
Any advise appreciated.
ASPNET, c# framework 4.0
You'd need to override virtual path provider, which doesn't seem to be a trivial task..
Also there is a similar question - Share aspx page between projects (suggests to reuse at user controls level).

How to set custom module as default in orchard cms

I made a custom module in orchard CMS.I want this custom module as startup module when i run my site but orchard always makes home page as start up.how can i make my custom module as Startup in orchard.My module is simple Mvc application using Entity frame work as db .I am pretty new to Orchard i am learning it.Any Help would be appriciated Thanks Advance
In order to steal the home route, you will have to write your own route, and give it high priority. Removing the alias for the current home page will also help.
If your module contains a content type and that content type has an autoroute part then there will be a checkbox in the edit content admin page that says 'Set to homepage'.
You can create lots of different types of modules in Orchard and not all of them contain content types. You can add an autoroute part to a content type that doesn't have one.
It is not true to say "set a module as start up".a module is not an stand alone mvc application, but it is a way of extending existing functionalities.
you can create a ContentType inside your module and orchard will provide the dashboard user with creating of new instance of your type.then user can set this instance as home page content.
to write your own ContentType check here.

URL Rewriting from Winforms or console application

I'm importing classic ASP pages into a new Sitefinity installation. Unfortunately, the existing site makes extensive use of URL rewriting via Helicon ISAPI Rewrite 3.
I'm generating the list of pages that need to be imported by crawling the navigation menus in the old site. These are, unfortunately, not dynamically generated from any sort of central repository, so the best way I've found to build the site hierarchy is to crawl the site.
When creating page nodes in the Sitefinity nav hierarchy to hold the content from the old pages, I need to be able to create the new pages at a location roughly equivelant to their location in the file system in the old site. However, the rewrite rules make this difficult to determine. For instance, I may get a link form parsing the old HTML like:
http://www.mysite.com/product_name
which is rewritten (not redirected) to
http://www.mysite.com/products/product_name/product_root.asp
I need a way to get the second url from the first. The first thing that comes to mind is to somehow use the .htaccess file to parse the URLs, get the result and use that for the rest of the import process.
Is there a way to do this from a Winforms app without having to involve a web server? I realize that I could modify one of the ASP includes, such as the page footer, to emit a comment containing the rewritten URL of each page, but I'd rather not make unnecessary changes to the existing code if it can be avoided.
Update
For example,
http://www.keil.com/arm/
rewrites to
http://www.keil.com/products/arm/mdk.asp

Categories

Resources