【问题标题】:dynamically Frame the URl in c#在 c# 中动态构建 URl
【发布时间】:2011-01-14 05:54:20
【问题描述】:

在c#中,我需要动态地构建以下URL,这里Action是redirectURL,控制器是Books,当我发布页面时,我会以以下格式将URL发送到其他页面。是否可以用“本地主机:7187”动态? http://localhost:7187/Books/redirectURL

【问题讨论】:

  • 你的问题有点难以理解。你能添加一些代码来更好地解释你的情况吗?
  • “框住网址”是什么意思?

标签: c# model-view-controller url asp.net-mvc-routing


【解决方案1】:

按照我动态构建 url(http://localhost:7187/Books/redirectURL) 的方式

Classname.WebsitePath + VirtualPathUtility.ToAbsolute(Url.Action("redirectURL", "Books"));

公共静态字符串网站路径 { 得到 { 返回 HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); } }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-04
    • 2015-08-11
    • 2019-02-03
    • 2010-10-13
    • 1970-01-01
    • 1970-01-01
    • 2015-11-29
    相关资源
    最近更新 更多