Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 59

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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 53

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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

722 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