[英]Dynamically created href attributes in C#
這是用於創建到Google的鏈接的C#代碼
href.Controls.Add(Image);
href.Attributes.Add("href", "www.google.com");
href.Attributes.Add("target", "_blank");
href.Attributes.Add("title", "Click To Follow The Link");
但是,當我單擊它時,它帶我到的網址是
http://localhost:52647/Mywebsite/www.google.co.za
關於如何使它直接進入Google的任何想法?
嘗試使用http://作為前綴
href.Controls.Add(Image);
href.Attributes.Add("href", "http://www.google.com");
href.Attributes.Add("target", "_blank");
href.Attributes.Add("title", "Click To Follow The Link");
更改href.Attributes.Add(“ href”,“ www.google.com”); 到href.Attributes.Add(“ href”,“ http://www.google.com ”);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.