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.