473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Send-To-Friend link with complete referrring URL

Hi, i would like to add a send-to-friend link at the top of every page. I would like the link to send the URL info to a popup window. here is what i have so far:

<a href="javascript:;" onClick="MM_openBrWindow('/global/sendtofriend/index.asp?URL=<%= Request.ServerVariables("SERVER_NAME")& Request.ServerVariables("URL")& "?" & Request.ServerVariables("QUERY_STRING")%>','','wid th=200,height=280')">

The only problem that i am having is that if the user is on a secure page, the link will not have a HTTPS:// - what can i add to the code that will find HTTP:// or HTTPS:// for the referral link?

Thanks,
Leon
May 8 '09 #1
3 3426
GazMathias
228 Expert 128KB
Hi

Request.ServerVariables("HTTPS") will return Off in HTTP mode, so you can check for that.

Example:

Expand|Select|Wrap|Line Numbers
  1. function gethttp(header)
  2. if header = "Off" then
  3. gethttp = "HTTP"
  4. else
  5. gethttp="HTTPS"
  6. end function
  7.  
  8. somevar = gethttp(Request.ServerVariables("HTTPS"))
  9.  
For future reference, this always comes in handy:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. For Each Item in Request.ServerVariables
  3.    Response.Write Item & ": " & Request.ServerVariables(Item) & "<br>" & vbNewLine
  4. Next
  5. %>
  6.  
Gaz
May 8 '09 #2
Thanks Gaz for the quick reply. I am a beginner, and if you have a moment, can you show me how to implement the code above? i would really appreciate it.
Thanks,
Leon
May 8 '09 #3
GazMathias
228 Expert 128KB
No Problem, if you were to use the function above then you would do so like:

Put this somewhere in your page:

Expand|Select|Wrap|Line Numbers
  1. function gethttp(header)
  2. if header = "off" then
  3. gethttp = "HTTP"
  4. else
  5. gethttp="HTTPS"
  6. end if
  7. end function
  8.  
Then modify your link to include the variable that you check first, like so:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. httpvar = gethttp(Request.ServerVariables("HTTPS"))
  3. %>
  4.  
  5. <a href="javascript:;" onClick="MM_openBrWindow('/global/sendtofriend/index.asp?URL=<%= httpvar & "://" & Request.ServerVariables("SERVER_NAME")& .... 'The rest of your link
  6.  
May 8 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: @rpus - Development | last post by:
I have the folloving function in vb .net: Function SendXMLReq() As String Dim returnval As String Dim xmlhttp As Object = New MSXML2.ServerXMLHTTP Dim objXMLSend = New MSXML2.DOMDocument Dim...
4
by: PawelR | last post by:
Hi, everbody. How send e-mail if smtp need authorization. If authorization is not required send email is not problem but I use SmtpMail.Send(myMail) PawelR
1
by: Hasan O | last post by:
hi , I have a problem with socket.send mesajlar = Encoding.ASCII.GetBytes("UGIR"); socketResultValue = socket.Send(mesajlar,0,mesajlar.Length, SocketFlags.None); socketResultValue =...
1
by: Hasan O | last post by:
hi , I have a problem with socket.send mesajlar = Encoding.ASCII.GetBytes("UGIR"); socketResultValue = socket.Send(mesajlar,0,mesajlar.Length, SocketFlags.None); socketResultValue =...
2
by: Ivan Weiss | last post by:
I am trying to send a test e-mail through my program using Outlook so that I know my code works and I can submit office forms through e-mail instead of paper. Here is my code: Dim objOutlook As...
3
by: ultr | last post by:
Hello, I have read that send() may not send whole message and returns the nuber of bytes sent, so that we can handle the rest of the message. Is it true, because i have tested sending even 1MB...
0
by: jjalexrayer | last post by:
How do send mail automatically in asp.net? Public people can register in my website. after registering system will send email every 10 days reports without any admin actions(that means...
0
by: Buddy Home | last post by:
There is two examples of code. Example 1. Send and Receive within the same process. Put this code in a console app called SendAndReceive and run the code. using System; using...
14
by: bb nicole | last post by:
I using session when creaate a forum. But it display error like: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at...
4
by: gvijayaratnam | last post by:
Hi All, I have a fn prototype as follows void print ( char *Buffer, usigned long bufferSize, int chunkSize ); This fn will accept binary file buffer and the buffer size and the chunk size,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.