3

how to convert UNC path to File URI.. For my application user will give css UNC path like this in test box :

\\egng4573\D$\CSS\Style.css

how can i change it to :

file:///D:/CSS/Style.css

so that firefox and IE both can access css from the desired path and apply on them.. please tell....

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
Maybe2013
  • 581
  • 1
  • 12
  • 21
  • 1
    You are aware that this will only work on the machine named `egng4573`? If you are having problems with this, it might be because of security restrictions, not because of problems with the path itself. Maybe elaborate on the context – Pekka Feb 23 '11 at 11:44
  • make it generalize....\\server\drive$\location.. ====>> file:///drive:/location......this is i wanted to ....actuallly i dont kno wat user gonna enter as unc path...nd this unc path works in IE but not in FF ....dats why i wanted it to change it to File URI... – Maybe2013 Feb 23 '11 at 11:52

1 Answers1

5

In .NET,

let unc = @"\\egng4573\D$\CSS\Style.css"

then

new System.Uri(unc)

should do it.

val it : System.Uri = file://egng4573/D$/CSS/Style.css
Pete Montgomery
  • 4,060
  • 3
  • 30
  • 40