What is Virtual Folder in Sdl tridion - tridion

Can any one help me regarding Virtual Folder in Sdl Tridion.
what is virtual folder in Sdl-Tridion ?
How to create Virtual folder ?
What are its uses ?

Virtual Folder has results from a data store or a custom index, and presents them visually in the format in which folder views are presented.
Virtual Folder thread answered here

Related

Accessing Files on Network from IIS

I have a shared path \\mynetworkshare\myfolder which has images stored.
I have a domain user mydomainuser which was granted with read access to files in that path
I hosted website on IIS. I created a Virtual Directory within my IIS Site with an Alias myphotos pointing to the Physical path \\mynetworkshare\myfolder. I have also clicked on Connect as... button in the Add Virtual Directory dialog box and provided my mydomainuser credentials.
I clicked on the newly created virtual director myphotos and click on Content View in the right pane. I'm able to view all my photos within IIS. From this, I assume the setup of virtual directory to my shared drive is correct.
Now, the question is how do I access this Virtual Directory or Files in it from my code?
I have tried below
var filePath = Server.MapPath("~/myphotos/" + "myimage.jpg");
When I write the filePath to a log file, I see it is trying to map to a physical folder setup within my website folders.
Instead of pointing to
\\mynetworkshare\myfolder\myimage.jpg
it is pointing to
d:\wwwroot\inetpub\mywebsitefolder\myphotos\myimage.jpg
I know Server.MapPath resolves to a physical path of hosted site but I wonder if it behaves the same with my virtual directory.
Or Do I need to let ASP.Net know somehow that myphotos is a virtual directory created on IIS? Or Am I on the wrong path to get files? Do I need to write code something different?
You can get the physical path from IIS (7+) using System.Web.Administration (available in NuGet)
var physicalPath = new Microsoft.Web.Administration.ServerManager()
.Sites["Default Web Site"]
.Applications["/MyApplication"]
.VirtualDirectories["/MyVirtualPath"]
.PhysicalPath;
If the virtual directory is in the root, the Application is "/"
What's specified in the Connect as... may only apply to direct web requests. To access the files from your application, you will need to configure the Application Pool to use mydomainuser as its Identity (found under Advanced Settings...), or you will need to grant share permissions to the computer running IIS if the Application pool uses a built-in account.
The step that was missing is converting Virtual Folder as Application.
Right-click the Virtual Folder myphotos, click on Convert to Application
The link here should explain the steps
Without adding Server.MapPath, it works fine. For example
image.src = "~/myphotos/myimage.jpg"

New Files In IIS virtual directory return file not found

I have a virtual directory in IIS. and I added a new file to the physical directory that the virtual directory points to.
but when trying to access this file through the virtual directory - I get file not found (404).
I tried to restart the web site and the IIS Server - but it didn't help.
the file is a css file.
There may be permissions error on accessing the file so.
First set the permissions to full control over read /write..(Options->Security->...)
https://support.microsoft.com/en-us/kb/315122
You should generally put your static files under the Content folder in an MVC application. By default, this folder will be configured to skip the MVC routing rules. Google for MVC Content folder for more information.

Virtual Directory in IIS 7.5

We got 2 websites (WebsiteA and WebsiteB). On WebsiteA, I chose "Add a virtual directory" and selected a folder on WebsiteB to be my physical path. The Alias is the same as the target.
As you can see, on WebsiteB, the folder "Main" is already an application.
In the forum, I saw that people with the same error forgot to convert the folder as an application, but mine is already done didn't?
I found that right clicking on my virtual directory (first image) and selecting "Convert to application" seems to work. Is it the right way to do this? By doing this, do I lose my virtual directory? I don't want to use duplicate content (if I edit something in the "Main" folder on websiteB, I don't want to edit the "Main" folder on WebsiteA manually too). I have been told to use the virtual directory as it's supposed to do the job, but none of us has used it before. Thanks
Virtual directories and applications work a little bit different in IIS > 6.0. Virtual directories used to be self contained applications in IIS 6.0, so your web.config file would be fine. But in IIS 7.0 and above, a virtual directory is just that, a pointer to a directory.
If you are looking for the same effect of a virtual directory as in IIS 6.0, you'll need to create an application underneath WebsiteA, not a virtual directory. A virtual directory in IIS 7 and above runs as a directory underneath the parent website, not as a separate application.

why it is still necessary to create virtual directory in IIS when website content is placed in IIS root directory

As virutal directory points to physical path of the application, so if the IIS root directory is C:\inetpub\wwwroot and the application is stored at D:\websites, than we need to create a virtual directory but if the application content is placed at C:\inetpub\wwwroot, then why still need to create virtual directory.
Actually you don't need to create a virtual directory. What you need to do is define it as an application folder, adding a virtual directory does this by default so that's why it works. All you really need to do is right click the folder under your website, click properties and under the Application Settings section click create. Your folder will then have a gear icon off to the side denoting it as an application folder.
As to why application folders are necessary, I believe it's a way of forcing you to choose which Application Pool you want the application running in rather than having every sub directory application running off the same pool by default.
IIS isn't used just for ASP.Net, it can serve up PHP for example...so the type of application and pool varies, it's not automatically created and tied to then ASP.Net engine.
If you can clarify a bit more what you're trying to do maybe we can help further. For example, if you want to point the root application to another folder and it be an application or create another website, IIS allows you to do any of that...you just need to update the question with which version of IIS, as the instructions very between them.
If the IIS site will host a single ASP.NET application you can place it at the root (C:\inetpub\wwwroot) and you don't need to create a virtual directory because when you create the site it is already a virtual directory.

Virtual directory deleted when publishing asp.net application?

A short question.
I have a website running at :80.
I create a virtual directory "itemimages" under the site that reference E:\itemimages.
When i publish the ASP.net to the website at :80 with "Delete all existing files prior to publish" the virtual directory "itemimages" is also deleted.
Any way to stop this from happening?
Or better: Any way to define the virtual directory inside the asp.net application so i will be created in any "fresh" publish?
Thanks in advance!
Try publishing the website to the directory, as opposed to the website? I.e. publish to c:\Websites\WebsiteRoot (or whatever the path is), as opposed to http://www.sitename.com/
Or you could try using the "Replace files" instead of deleting all preexisting files ?

Resources