| 
               | 
            
              Embedded
             | 
          
protected static string MapResourceToWebApplication( string baseNamespace, string resourcePath )
| Exception | Condition | 
|---|---|
| ArgumentNullException | Thrown if baseNamespace or resourcePath is . | 
| ArgumentOutOfRangeException | 
            Thrown if baseNamespace or resourcePath:
            
  | 
The baseNamespace is stripped from the front of the resourcePath and all but the last period in the remaining resourcePath is replaced with the directory separator character ('/'). Finally, that path is mapped into a web application relative path.
The filename being mapped must have an extension associated with it, and that extension may not have a period in it. Only one period will be kept in the mapped filename - others will be assumed to be directory separators. If a filename has multiple extensions (i.e., My.Custom.config), it will not map properly - it will end up being ~/My/Custom.config.
If baseNamespace does not occur at the start of the resourcePath, an InvalidOperationException is thrown.
Given a baseNamespace of MyNamespace, this method will process resourcePath as follows:
| resourcePath value | Mapping in Web App | 
|---|---|
| MyNamespace.Config.MyFile.config | ~/Config/MyFile.config | 
| MyNamespace.MyPage.aspx | ~/MyPage.aspx |