Hide the actual local folder location in iframe src - asp.net

I have the problem to show the html file on local drive in my aspx page on IE9. I have read the question at how to set iframe src to local file.
I can show the html file which is on the another drive on the server by the below code.
<iframe src="\\servercomputer\G$\test6.html" title="test" />
I don't want people see my actual folder location. I tried to create the virtual directory under the website, but I got the "cannot find the page error" Would someone show me what I should do.
Thanks in advance.

It's possible to have virtual directory that points at a network location - you will have to play with the "Connect As" and specify name/password for access:
IIS Virtual Directory map to network drive (with drive letter) but fail to create file
Another way (possibly better) would be to have a proxy in C# that would download the file from another server

Related

Is there any feature is providing the microsoft teams to load static web pages(html/aspx) in browser

I am trying to upload the html file and aspx file in teams. once it is loaded then get the copy of files address
and i am going to load that copied path url in browser but it is not showing web content which i design like web page.
in browser (html/aspx) files are downloading. If i am trying to load apsx file in browser it was showing like error(Something went wrong File Not Found),
so want i like is that is there any feature to load in browser?
Thanks for your detailed explanation.
First of all, Teams does not host any html or aspx file itself. So you can not upload a file and use the URL to render web page in browser. The file URL is a link to that uploaded file location. That's the reason the file is getting downloaded in browser.
Secondly, it is other way round. You can run your website in any other server and use that URL to configure a tab in MS Teams.
Please go through these links
What can Teams apps do?
How do tabs work?

HostingEnvironment.VirtualPathProvider.FileExists returns false on existing file

I'm trying to read a file in a virtual path, using the following code
HostingEnvironment.VirtualPathProvider.FileExists(_SiteMapFileName)
_SiteMapFileName has something like "~/Content/en-US/MainMenu.sitemap" and it is always returning false.
But if I access the URL of that virtual path (http://www.local.mysite.com/Content/en-US/MainMenu.sitemap), the file displays correctly in the browser
Content is a virtual directory under my website, pointing to a shared folder on a different location. If I access that location on Windows Explorer I can see the files correctly
I've set the site and the virtual directory to connect as my network account.
I used the process monitor tool to see if there's any problem and it says that w3wp.exe is trying to create the file \path\to\shared\location\Content\en-US\MainMenu.sitemap but it is getting ACCESS DENIED which is fine since it is a read-only location
Does anybody now how to solve this issue?
I found out the reason. The user set to run the app pool tied to the application needs to have permissions on the file is trying to read, not only the website and the virtual directory. :/
when i am working with vDir i use Server.MapPath
Does that not work for you?
if(System.IO.File.Exists(Server.MapPath("Relative Path to vDir")))
{
//do something with the file
}

What is the best way to show an image (which is in local machine) in picturebox

I'm working on a project in ASP.NET but I'm stucked in this case;
I have ten thousands of images in local machine. I need to show them in the picturebox in ASP.Net. I can not copy all images to web appliation folder. So I have to give the file path like
\\server\something\something.jpg
But it doesnt work of course.
I found some solutions but they are not so clear, so I didnt manage to success.
So what should I do ?
In IIS, define a virtual sub-directory in your site, with directory's physical location being \\server\something. Then you will be able to specify image virtual url as ~/something.jpg.
Use code-behind to return images (aspx page or ashx handler) - then, with enough permissions given to IIS user, the web application will read the required image and put it in response stream.

Browse for file window without uploading the file

Is there a way to get the select file dialog box open and putting the location of the file into a textbox without ever uploading the file?
ETA I'm using VB.NET in a web page. By using the asp:fileupload tag I can get the file location
_fudFileLocation.PostedFile.FileName_
But how do I prevent the file from being uploaded at all. We don't need it, just the file location. (The files are on a shared drive so if it's M:\documents\todayslunch.pdf for person A, it's the same for person B.)
You do not get access to the full filepath in the browser because of security.
If this was possible, one could get the full layout of the computer of anyone going to any website.
System.Web.HttpPostedFile.FileName gets the fully qualified name of the file on the client which includes the directory path.

Need help setting up simple Virtual Directory in IIS7

Noobie question...
Using IIS7, I am trying to create a virtual directory for the folder that contains my video files, but can't get my head around how it is done.
For example...
The existing address is http://www.mydomain.com/members
which points to C:\wwwroot\mydomain\members
I need http://www.mydomain.com/flash-members to point to the same path.
The existing IIS path to the members folder is Server\Sites\www_mydomain_com\members (has application icon)
Any help is appreciated.
For your example, assuming www_mydomain_com is the Site (little world icon), you can do this by:
Open IIS Manager
Right-click the web site, select Add Virtual Directory
In the Alias field, enter flash-members
In the Physical Path field, enter your path (C:\wwwroot\mydomain\members)

Resources