开发者

How can i get the RawUrl in asp.net code?

开发者 https://www.devze.com 2023-03-08 10:43 出处:网络
I would like to get the RAW url dynamically in my ASP.NET webpage but i cannot figure out how to do it. Something like the dummy code below...

I would like to get the RAW url dynamically in my ASP.NET webpage but i cannot figure out how to do it. Something like the dummy code below...

<div id="fb-root">
 <script src="http://connect.facebook.开发者_高级运维net/en_US/all.js#xfbml=1"></script>
 <fb:comments href= '<% REQUEST_RAW_URL %>' num_posts="2" width="592"></fb:comments>
</div>

You see i would like to use it in the facebook comments box.

UPDATE: And here is the Url rewrite rule that i use

<add name="Rule1" virtualUrl="^~/temp/(.*)/(.*).aspx" 
rewriteUrlParameter="ExcludeFromClientQueryString" 
destinationUrl="~/Directory/page.aspx?ItemID=$1&amp;id=$2&amp;lng=gr"/>


What is the <fb:comments>...</fb:comments> tag? Is this a server side tag? If so, you need to add runat="server" to the properties to make it interpreted server-side.

Try this:

<fb:comments href='<%=HttpContext.Request.RawUrl %>' num_posts="2" width="592" 
    runat="server"></fb:comments>


Have you tried:

<%= Request.Url.AbsoluteUri %>
0

精彩评论

暂无评论...
验证码 换一张
取 消