Elliott Ward
asked on
Links in old ASP pages are getting an extra slash added to them, how may I remove them?
This ASP page I am supporting has this line in it:
document.write ("<a style='color:#ffffff'id='l ogin' 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?
document.write ("<a style='color:#ffffff'id='l
However when the link is actual clicked it is changed to:
https://Default.asp/?Type=LogIn
How do I remove that extra slash?
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.
If so then you need to look for something in your code that is doing a redirect.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
I would still change the code a bit.
First at the top of the page, force https
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
%>
Then change the link code todocument.write ("<a style='color:#ffffff'id='login' href='/Default.asp?Type=LogIn' target='_parent'>Login</a>");
i tested out the following code and it worked fine. is this similar to what you have?
Open in new window