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
288 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 32

Expert Comment

by:Big Monty
Comment Utility
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 51

Expert Comment

by:Julian Hansen
Comment Utility
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 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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 32

Expert Comment

by:Big Monty
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now