首页 新闻 会员 周边 捐助

用ViewEngineResult把网页输出 URL自动加前缀怎么解决啊?

0
悬赏园豆:5 [已关闭问题] 关闭于 2014-08-13 21:23

private string ConvertViewToHtmlString(ControllerContext c, string viewName, object data)
        {
            if (data != null)
            {
                //set view data notifications
                ViewData.Model = data;

                StringWriter output = new StringWriter();
                //find the view to general html string
                ViewEngineResult result = ViewEngines.Engines.FindView(c, viewName, "");

                ViewContext viewContext = new ViewContext(c, result.View, ViewData, TempData, output);

                try
                {
                    //render the view to stringWriter, rather than on Response stream
                    result.View.Render(viewContext, output);
                }
                finally
                {
                    //release the view so that it can be used by other controllers
                    result.ViewEngine.ReleaseView(c, result.View);
                }

 
                //html string for the view
                return output.ToString();
            }
            else
            {
                return "";
            }
        }

 

data里的src本来为https://join.expediapartnercentral.com.lisqa8.sb.karmalab.net/onboarding///photos/displayphotoforemail?photoid=4133&hotelid=8014091"

经过上面的方法以后变成了如下啊

 

 <div style="margin-left:8px; margin-right:8px">
                                                <img src="http://localhost:16711https://join.expediapartnercentral.com.lisqa8.sb.karmalab.net/onboarding///photos/displayphotoforemail?photoid=4133&hotelid=8014091"
                                                    style="width:80px; height:80px;margin-top:2px;" alt=해야 합니다..JPG />
                                            </div>   

吴顶天的主页 吴顶天 | 初学一级 | 园豆:39
提问于:2014-07-30 17:40
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册