【发布时间】:2010-09-10 12:14:18
【问题描述】:
我有一个相对 URI:
Uri U = new Uri("../Services/Authenticated/VariationsService.svc",
UriKind.Relative);
问题在于,根据用户是否在其 Web 浏览器中键入 https:// 或 http:// 来访问 silverlight 应用程序,它可能在尝试联系服务时使用 http 或 https。
我想强制程序使用 https 来连接服务。
最初我尝试过这个:
Uri U = new Uri("../Services/Authenticated/VariationsService.svc",
UriKind.Relative);
string NU = U.AbsoluteUri;
U = new Uri(NU.Replace("http://", "https://"), UriKind.Absolute);
但它在 U.AbsoluteUri 失败,因为它无法在那个阶段将相对 Uri 转换为绝对 Uri。那么如何将 Uri Scheme 改为 https 呢?
【问题讨论】:
-
标题中无需重复标签。我去帮你修好了。
标签: c# silverlight wcf iis-6 https