How to get the Url of saved HttpPostedFileBase type file

1k Views Asked by At

I have saved the file using HttpPostedFileBase Type and now I am in a situation where I need to send an Email body which will contain Url of this saved file. So that user can directly click on this link and see what file has been uploaded. Right now I am doing this :

var  fileName = (HttpPostedFileBase)file.FileName;
string FileUrl = urlBase.Scheme + 
                 "://" + 
                 urlBase.Authority + 
                 "~/media/UploadedFiles/" + 
                 fileName;

is there any better way to do this. Calling any Inbuild method directly which would return me the Url if I provide the relative path of the file.

Help appreciated!

0

There are 0 best solutions below