ASP code HREF help needed

Windows 2012 R2 Web Server
IIS 8.5

Just moved my sites from a Windows 2003 with IIS 6 web server
Also moved many pages from wwwroot to wwwroot\folder2

one of the pages in wwwroot\folder2 calls a page that is still in wwwroot
when I click on the link I get 404 - File or directory not found.

this is my code

    <input type="button" value="Sign Our Guest Book" onClick="window.location.href='GuestBook.htm'">

I tried this by adding ~/  which places you back to the root but since the site is in folder2 I am thinking the folder2 is the root for that site

    <input type="button" value="Sign Our Guest Book" onClick="window.location.href='~/GuestBook.htm'">

Open in new window


how do I get test.asp to call guestbook.htm using the onclick href?


LVL 23
Thomas GrassiSystems AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontyWeb Ninja at largeCommented:
remove the tilda:

    <input type="button" value="Sign Our Guest Book" onClick="window.location.href='/GuestBook.htm'">

Open in new window

Thomas GrassiSystems AdministratorAuthor Commented:
Big Monty


Same results.

The url comes up like this

And guestbook.htm is not in that folder

check it out

select guestbook at bottom of page your will see
Big MontyWeb Ninja at largeCommented:
my apologies, i mis-understood your question, i thought guestbook was at the root

whats the folder name for the guestbook.asp page?
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Thomas GrassiSystems AdministratorAuthor Commented:
Big Monty no worries

here is my folder structure

three files reside in this folder

guestbook.htm is what is called by the onclick  href

now in

    <input type="button" value="Sign Our Guest Book" onClick="window.location.href='/GuestBook.htm'">
Big MontyWeb Ninja at largeCommented:
it would be easier if you could move the file(s) to your music folder, which is now your root folder (if I understand correctly). otherwise, you may need to make wwwroot a virtual folder (which I've never heard being done before) or the following code may work (but I doubt it)

    <input type="button" value="Sign Our Guest Book" onClick="window.location.href='/../GuestBook.htm'">

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
here is my folder structure
To clarify - - does not load the page guestbook.htm - if entered into a browser?
Thomas GrassiSystems AdministratorAuthor Commented:
If I copy the files into the music folder then I will have two copies of the same code.

In wwwroot is my main site home pages which call the same guestbook.htm  code.

any other ideas?

ps /../ same results
Wayne BarronAuthor, Web DeveloperCommented:
Inside of the music folder.
Create a folder called: Guest
Inside of that folder. move all the files over that go with the Guestbook pages.
Now, you just reference them like you supposed to.

you stated that you would have 2 copies, if you moved them over there.
In that case, why don't you simply just use the existing pages that are already in the music folder?

Need some more information on what exactly you are trying to achieve.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Your home page links to

What is the purpose of mixing up .htm and .asp files and different folders?  It's best to keep either all .asp or .htm/.html.
Thomas GrassiSystems AdministratorAuthor Commented:
Thanks every one for your help

I moved them to a new folder under the music folder

I like keeping code organized makes things easier to find when trouble shooting

Thanks again
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.