Solved

Links in old ASP pages are getting an extra slash added to them, how may I remove them?

Posted on 2014-04-22
5
297 Views
Last Modified: 2014-04-23
This ASP page I  am supporting has this line in it:

document.write ("<a style='color:#ffffff'id='login' href='https://Default.asp?Type=LogIn' target='_parent'>Login</a>");

However when the link is actual clicked it is changed to:

https://Default.asp/?Type=LogIn

How do I remove that extra slash?
0
Comment
Question by:Elliott Ward
5 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 40016595
the href code itself is syntactically correct, although you should have a space between the style value and the ID attribute.

i tested out the following code and it worked fine. is this similar to what you have?

<html>
	<body style="background-color:#000;">
		<script type="text/javascript">
			document.write("<a style='color:#ffffff' id='login' href='https://Default.asp?Type=LogIn' target='_parent'>Login</a>");
		</script>
	</body>
</html>

Open in new window

0
 
LVL 55

Expert Comment

by:Julian Hansen
ID: 40016780
What happens if you type this https://Default.asp?Type=LogIn directly into the browser - does the same thing happen?

If so then you need to look for something in your code that is doing a redirect.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40016817
Actually, the code is Not correct because you need to have a domain name, not just a file name, after the 'https://'.  It's probably trying to make 'Default.asp' formatted as a domain name.
document.write ("<a style='color:#ffffff' id='login' href='https://www.yourdomain.com/Default.asp?Type=LogIn' target='_parent'>Login</a>");

Open in new window

0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40017460
if the desired result was to get an output of

https://Default.asp?Type=LogIn

then the code, syntactically, IS correct. I know because I tested it out :)

as for the format of the url, that is indeed a different matter. There is no need to have the https:// as part of the doamin IF you are accessing a page on the same server. However, if you are going to another URL, then you need to specify a domain as DB noted.

I agree with JulianH, it's probably a redirect issue.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40017609
I would still change the code a bit.

First at the top of the page, force https
<%
   If Request.ServerVariables("SERVER_PORT")=80 Then
      Dim strSecureURL
      strSecureURL = "https://"
      strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
      strSecureURL = strSecureURL & Request.ServerVariables("URL")
      Response.Redirect strSecureURL
   End If
%>

Open in new window

Then change the link code to
document.write ("<a style='color:#ffffff'id='login' href='/Default.asp?Type=LogIn' target='_parent'>Login</a>");

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question