简体   繁体   中英

A href's link is changed when I run the project in MVC

I am trying to create a link in my project using this code :

<body> 
     <ul>
         @foreach (Menu menu in ViewBag.menu)
         {
             <li>
                 <a href="www.google.com">google</a>
             </li>
         }
     </ul>
 </body>

But when I run my project in mvc, the link of this code is change to http://localhost:2321/www.google.com .

So how can I remove this part http://localhost:2321 ?

Just specify the full link, with protocol; otherwise it is interpreted as if you are trying to access a local object (by relative path):

<a href="http://www.google.com">google</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM