https://msdn.microsoft.com /en-us/library/system.uri%28v=vs.110%29.aspx [ ^ ]。 这是解析它的示例: https://en.wikipedia.org/wiki/URI_scheme#Examples [ ^ ]。 这样,您可以删除或替换某些片段,例如作为方案名称https,但如果你考虑如何避免使用表示数据的字符串而不是数据本身,那会更好。 -SA 将其替换为空字符串, string url = < https://example.net/...>; string urlToUse = url.Replace( https://, ); // 空字符串 urlToUse 现在将拥有您要使用的URL。 < a href =' http :/+ VirtualPathUtility.ToAbsolute(// tyrescanner.net/pages/Activation.aspx)+?ActivationCode =+ ActivationCode +' > 点击此处激活您的帐户。< / a > ; 但是ToAbsolute不应该包含域名,所以你应该ToAbsolute /pages/Activation.aspx然后在开始时添加http://域。 Hi folks, I need to remove https from my embedded link.At the moment the link is created like this:https://tyrescanner.net/pages/Activation.aspxWhich does not work I need the link to be like this:tyrescanner.net/pages/Activation.aspxMy code so far:<a href = '" + VirtualPathUtility.ToAbsolute("//tyrescanner.net/pages/Activation.aspx") + "?ActivationCode=" + ActivationCode + "'>Click here to activate your account.</a>"; 解决方案 You should better use System.Uri class. Create an instance with string parameter representing your URI, which will parse the string into URI components, such as Scheme, Host, and so on:https://msdn.microsoft.com/en-us/library/system.uri%28v=vs.110%29.aspx[^].For understanding the components of URI, please see:https://en.wikipedia.org/wiki/URI_scheme[^],https://msdn.microsoft.com/en-us/library/system.uri%28v=vs.110%29.aspx[^].This is the example of parsing it: https://en.wikipedia.org/wiki/URI_scheme#Examples[^].This way, you can remove or replace some fragment, such as scheme name "https", but it would be much better if you think how to avoid using strings representing data instead of data itself.—SARemove it by replacing it with an empty string,string url = "<https://example.net/...>";string urlToUse = url.Replace("https://", ""); // empty stringurlToUse would now have the URL that you want to use.<a href = 'http:/" + VirtualPathUtility.ToAbsolute("//tyrescanner.net/pages/Activation.aspx") + "?ActivationCode=" + ActivationCode + "'>Click here to activate your account.</a>";However ToAbsolute is not supposed to include a domain name, so you should ToAbsolute the "/pages/Activation.aspx" then add the http://domain at the start. 这篇关于如何删除“https”来自我的嵌入式链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!