Go Premium for a chance to win a PS4. Enter to Win

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
?
310 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 34

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 60

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 34

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 54

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month12 days, 5 hours left to enroll

916 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