How to get URL of website via code

I have an listview that lists a set of images and underneath the image I want to display the full URL of the image.

So like

How can I contacentate

Request.Url.GetLeftPart(UriPartial.Authority)  in code behind  AND CONCATENATE IT TO  <img src="<%#Eval("picPath") %>"  
<img src="<%#Eval("picPath") %>"

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you can use image control instead of html img and this will take care of image path mapping

<asp:Image ID="Image1" runat="server"  ImageUrl='<%# "~/" +Eval("picPath") %>'/>

mugseyAuthor Commented:
Hi thanks but I can display the images OK however

 I need to display the full path in text

so something like

TEXT='<%# "~/" +Eval("picPath") %>'/>

Try this function:
 protected string GetFullPath(string relativepath)
         //string relativepath = "pic1.jpg";
        string domainpath = Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + (Request.Url.Port != 80 ? ":" + Request.Url.Port : "");
        string applicationpath = Request.ApplicationPath;
        string fullpath = domainpath + applicationpath + "/" + relativepath;
        return fullpath;

Note: If your relative path already has / in front then remove "/" from full path.

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

mugseyAuthor Commented:
thanks sami

How can add GetFullPath  to markup?


TEXT='<%# "Eval("GetFullPath")  +Eval("picPath") %>'/>
TEXT='<%# GetFullPath(Eval("picPath").ToString())%>'/>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mugseyAuthor Commented:
Guru Sami

Excellent answer!!!!!!!   ;-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.