[英]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.