ApplicationRootUrl
Helper
GetPage.aspx
Imports System.Diagnostics Namespace SalesMarketing Partial Class GetPage Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim strRequestedURL As String = "" If Not Request("RP") Is Nothing Then strRequestedURL = Helper.ApplicationRootUrl strRequestedURL &= Request("RP") strRequestedURL &= Request("RF") End If WriteLog(strRequestedURL) Response.Redirect(strRequestedURL) End Sub Private Sub WriteLog(ByVal strRequestedUrl As String) 'Dim intModuleId As Int16 = 0 'Dim lngSearchLogId As Long = 0 'Dim strFromURL As String = "" ''-- Inits ----------------------------------------------------------------------------- 'If Not Request("MId") Is Nothing Then ' If IsNumeric(Request("MId")) Then ' intModuleId = CType(Request("MId"), Int16) ' End If 'End If 'If Not Request("SLId") Is Nothing Then ' If IsNumeric(Request("SLId")) Then ' lngSearchLogId = CType(Request("SLId"), Long) ' End If 'End If 'If Request.ServerVariables("HTTP_REFERER") <> "" Then ' strFromURL = Request.ServerVariables("HTTP_REFERER") ' RequestFromPage 'End If 'Dim currUser As String 'currUser = HttpContext.Current.Request.ServerVariables("AUTH_USER") 'currUser = Mid(currUser, InStr(currUser, "\") + 1) 'Dim strIsAuthor As String = CType(Me.Master, Site).IsAuthorByModule(intModuleId) ''-- Make Database Call ---------------------------------------------------------------- 'Dim cl As New SalesMarketing.BusinessLogicLayer.ClickLog 'cl.Add(intModuleId, lngSearchLogId, currUser, strFromURL, strRequestedURL, Now(), _ ' strIsAuthor) 'cl = Nothing End Sub End Class End Namespace
TODO
<configuration> <appSettings> ... <add key="LinkAsPage" value="GetPage.aspx"/> ... </appSettings> </configuration>
/images
link.jpg
bullet.gif
ShowLinkAs.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ShowLinkAs.aspx.vb" Inherits="SalesMarketing.ShowLinkAs" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Link As</title> <link href="Styles.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <div> <table cellpadding="0" cellspacing="0" width="100%" height="100%" border="0"> <tr> <td align="center" class="lbl-header">Link Document/URL As</td> </tr> <tr> <td class="standard-instruction"> <img src="./images/bullet.gif" /> Please copy the below text to link the document/url.<br /> </td> </tr> <tr> <td align="center"> <br /> <br /> <asp:TextBox ID="txtLA" runat="server" Columns="100" Rows="5" Width="600" Height="100" Wrap="true" CssClass="standard-text"></asp:TextBox> <br /> <br /> <input type="button" value="Close" onclick="javascript:window.close();" /> <br /> </td> </tr> <tr><td> </td></tr> </table> </div> </form> </body> </html>
Namespace SalesMarketing Partial Class ShowLinkAs Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load txtLA.Text = Helper.ApplicationRootUrl txtLA.Text &= ConfigurationManager.AppSettings("LinkAsPage") & "?MId=" txtLA.Text &= Request("MId") txtLA.Text &= "&RP=" & Request("RP") txtLA.Text &= "&RF=" & Server.UrlEncode(Request("RF")) End Sub End Class End Namespace
<script language="javascript"> . . . function showLinkAs(iVal) { var vURL = "ShowLinkAs.aspx" + iVal; if (window.showModelessDialog) sList = showModalDialog(vURL, window, "dialogHeight:250px; dialogWidth:750px; edge:sunken; center:yes; help:no; status:no; scroll:no; resizable:no;"); else alert("This method is only supported by Internet Explorer 4 and above."); } . . . </script>
Private Function BuildLink(ByVal id As Integer, ByVal file As String) As String '-- Inits --------------------------------------------------------------------------------- ' TODO: Adjust the queryString template appropriate to your implementation Dim queryString As String = "?RP=uploads/TD/{id}/&RF={file}" Dim imageLink As String = "<a href='javascript:showLinkAs(""{queryString}"")'>" imageLink &= "<img src=""./images/link.jpg"" border=none /></a>" Dim result As String = "<a target='_blank' href='GetPage.aspx{queryString}&SLId=0'>" result &= "{file}</a> {imageLink} " file = Server.UrlEncode(file) '-- "Fill In" the templates --------------------------------------------------------------- queryString = queryString.Replace("{id}", id) queryString = queryString.Replace("{file}", file) imageLink = imageLink.Replace("{queryString}", queryString) result = result.Replace("{queryString}", queryString) result = result.Replace("{file}", file) result = result.Replace("{imageLink}", imageLink) '-- Clean Up ------------------------------------------------------------------------------ Return result End Function