Tips for using the link module of dnn

Source: Internet
Author: User
Tags dnn

 

This control is not very good, but it has a feature that makes me unforgettable, that is, no matter how you get it, you cannot add relative directories or addresses.

For this reason, I have read the source code.

In urlcontrol. VB

Public
Property URL ()
The following statements are available in the string attribute:


Select
Case strcurrenttype


Case
"U"


If cbourls. Visible then


If
Not cbourls. selecteditem is
Nothing
Then

R = cbourls. selecteditem. Value

Txturl. Text = r


End
If


Else


Dim mcustomurl
String = txturl. Text


If mcustomurl. tolower = "http ://"
Then

R = ""


Else

R = addhttp (mcustomurl)


End
If


End
If

Let's look at what addhttp has done.


'''-----------------------------------------------------------------------------


''' <Summary>


'''Adds HTTP to URL if no other protocol specified


''' </Summary>


''' <Remarks>


''' </Remarks>


''' <Param name = "strurl"> the URL </param>


''' <Returns> the formatted URL </returns>


''' <History>


''' [Cnurse] 12/16/2004 then ented


''' [Cnurse] 05/06/2005 added chack for mailto: Protocol


''' </History>


'''-----------------------------------------------------------------------------


Public
Function addhttp (byval strurl
String)
String


If strurl <> ""
Then


If instr (1, strurl, "mailto:") = 0 and instr (1, strurl, ": //") = 0 and instr (1, strurl ,"~ ") = 0 and instr (1, strurl," \ ") = 0 then


If httpcontext. Current. Request. issecureconnection then

Strurl = "https: //" & strurl


Else

Strurl = "http: //" & strurl


End
If


End
If


End
If


Return strurl


End
Function

From the above two points, we will find out why dnn always adds http: // to us.

The theory is to add \ path \ and ~ /Path does not add http ://

However

Tested, only ~ is added to the link module ~ /Path will be converted to an expected address similar to http: // localhost/dotnetnuke/path

That is to say, it will be replaced with the virtual root directory we want

I thought it was the same in the tab. After testing, I found that this goal cannot be achieved in the tab.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.