2

I have an HttpModule for a web application I use (SharePoint). I want to be able to identify when a file is being viewed through UNC (\Server\Something). The Request.Url.IsUnc always returns false, and the call always shows "http://", even though a user tried to browse the directory through UNC.

Is there any way do be able to identity UNC access?

user1477327
  • 144
  • 8

1 Answers1

3

Per: http://msdn.microsoft.com/en-us/library/system.uri.isunc.aspx

The IsUnc property is true if the specified Uri instance is a UNC path (such as \server\folder or file://server/folder). This property always returns true if the URI has the file:// scheme and specifies a host component.

Therefore, if the call always shows "http://", IsUnc will not identify it.

If that doesn't help, there are some alternative methods defined in this post:
Easiest way in C# to find out if an app is running from a network drive?

Community
  • 1
  • 1
ems305
  • 1,030
  • 11
  • 7
  • No, what I meant is I click Start--> run --> and then \\Server\File1.docx. The HTTPModule intercepts the request, but the URL is http://Server/File1.docx and IsUnc is false, although the access was made via UNC. that's the issue... – user1477327 Jul 08 '12 at 10:27