I am trying to find ways, by which a user can open a folder on web-server on button click in a web application, based on windows authentication and no impersonation.
Two methods, that i have came across are :
Using href link, it works, but only in IE.
Open "
Using C#, It doesn't seem to work, i gave permissions to Application Pool and Users to access the folder, but was getting access denied.
System.Diagnostics.Process.Start(#"\\test\c$\xyz");
Starting with "accessing to administrative shares isn't a good idea", if your users attempts to access to it as normal user (i.e. probably not logged/verified by a domain controller) will surely fails.
Assuming you want to access to a granted share you should link using file: as URI scheme.
Local folder:
click me
Remote folder:
click me
here works both with IE and FF.
Read this:
http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
Taken from:
How to open a windows folder when clicking on some link on a HTML page using Python
Related
I'm working on a project to access SharePoint folders and open them directly with Windows Explorer. When opening the folder manually (Open explorer and directly type in the exact SharePoint folder path),it prompts for my Active Directory login to authenticate and provide read/write access. Once I have done this once it won't ask again until I reboot.
My issue is when I try to access a folder for the first time with my code, it just spits me out into a generic path (like My PC or Documents). It appears that it tries to access the folder, realizes I don't have access, and defaults to basic explorer window.
Is there any way for me to check for read/write access, check if credentials are required, and trigger the default Windows Security window to ask for authentication? I'm really trying to avoid handling user credentials with my code. Below is what I'm currently using to open the folder.
string foldername = #"Sample Project Folder";
Process.Start("explorer.exe",#"\\sp.companyname.com#SSL\DavWWWRoot\dc\Projects\" + foldername);
System.Windows.Application.Current.Shutdown();
Thanks in advance!
I recently hosted a MVC application on machine and in solution I have a folder UploadedDocuments which i wants to secure. Actually when i browse URL like www.xyz.com/UploadedDocument it lists all the file even i didn't login to website
Note: Using Microsoft Interop for PDF conversion of docs in this directory.
wants to restrict the users who can browse folder but if a url with file name in folder and a user on website that is loggedin can access only with specified url
like www.xyz.com/UploadedDocument/abc.docx(except www.xyz.com/UploadedDocument)
thanks in advance!
In IIS, ensure that directory browsing is disabled.
On the file system, remove read access for any "normal" user accounts or groups, and have only the app pool account that IIS is running under with modify access to the folder (ie the "iis apppool\[MyApplication]" account).
You say you're using Microsoft interop for conversion. Is the conversion happening within the MVC application, or do you have another application / service performing the conversion? If the latter, also ensure that whatever account is running the other application / service has access to modify the folder.
I would like to know if it is possible to open a directory from intranet MVC application ? I have been searching about it but i don't found anything.
I tried to open from javascript using window.open('url') but i get unauthorized access.
Thanks,
Tiago MourĂ£o
IMPOSSIBLE !!!
web browsers does not have allow web pages to access to disk drives.
web pages only can read/write cookies.
FileUpload control allow access to the files, only with user action(scripts no allowed).
I found a way to do resolve this problem. If you create a background process using Process.Start('location'), the application opens directory folder.
Tips:
Process.Start() generally used in windows application and if used in
web applications, a process will start on server(not on user agent
that run current page).
you get unauthorized access error, because of IUser has limited
access ...
1) Web Applications can read/write any file and folders on server side with assigning permission.
2) WebApplication with Some sideway can access to file & folders in web pages (client side) !!!
with JavaScripts:
Write a browser add-on with requested functionality, then install on
user agent(browser).
now with call method/function in add-on, you can do the operations
that does not allowed with JavaScript & etc.
with VBScript(Obsoleted) that run/supported only in MsIE:
can using FileSystemObject to full access files and folders.
can using CreateObject to create instance of each object in OS and
working with it.
Finally my answer is IMPOSSIBLE.
To begin with, I developed a web application which reads an XML file from specific location and displays the contents on editable web page of the application,which is executed perfectly when the XML file is on the same machine/computer. When I try to read the same file on different computer on the network I cannot read the contents onto my web page.
My Observation:
When I access that file from run window in the computer by entering \xxx.xxx.xx.xx\c$ it gives me the window to connect to the machine asking for credentials and I guess the session is open. So I close the window and when I access the xml file from the web application it's able to read the content.
Is there a way to bypass this authentication mechanism which is part of windows when I use my web app to read the XML file or is there a way to accommodate the extra step to configure the authentication in my application?
I would be glad if someone can guide me to the solution.
Check the user your web application is running under and if this user is also permitted to access this location.
If you are using IIS to host the page you have to check the "AppPool" user and also the users which are used at the "Web Site" and "Application"
Just change IIS application pool user to "enough rights" user (right click current app pool - advanced settings - identity) or specify impersonation in the same name section in web.config.
Could it be possible to change your logic,
By storing file from different network to local machine where your code is running, through uploading file and process it.
Lets say we have photographers who use one computer in a department. They take pictures of an event then upload and organize pictures in an application. That application by default takes someone's shared location and copies pictures to that share.
On a web server there is a share we point it to. We want to make it so ONLY that application can access that share, and only THAT web application (of course, anyone with admin login to the physical server can).
Also make it so that any web browser can display the image (I believe Firefox can't take a file location of \\server\share)
Logically it would look like this:
Photographer uses an application on a public computer
Application copies images to share
Web application uses images (cross browser)
No user from public computer can access those images EDIT: the displaying on the webpage is not the problem, its how I store files in the webroot securely, so that my app can SHOW the images that are located within a shared location in a webroot. Allowing only the application on a terminal computer to access that share and NOT the user running the application from that computer. I.e. a person cant just run a command and download the entire directory contents from wherever he wants.
Wait, what? You want to show the users some pictures in a browser, but don't allow them to download them? That's impossible.
Simply configure your share's permissions (ie right click on it) to be limited to a certain windows user. Run your application under that windows user so it will have access to that share. Done!
Create a service account and run/impersonate your web and desktop applications with the
service account
Share the pictures (located on the shared drive) for the service account so that no other
user can access