How to disable the folder navigation in the browse file popup window that appears when browse button is clicked in FileUpload control.
Currently, the browse file popup window shows specific folder which contain subfolders and files; I want to limit the user; user should not be able to browse/navigate through the upper level folders.
The asp.net server control is really just a wrapped html input type=file . The problem you're experiencing isn't limited to ASP.net and unfortunately, there's no way to affect the browser's behavior on that from your app.
You can't do this with an input type=file but you may be able to if you can use a flash-based file upload control instead.
The standard controls don't allow much flexibility. Possibly a more specialized component can help...
You'd likely have to download a component or plugin to the user's browser that the user allows to install so you can access their local file system and custom traverse it. This used to be done with IE/ActiveX in the Windows world, but there were/are a lot of security issues with it and it's platform restrictive.
A .NET-based component is Silverlight File Uploader.
I think Telerik's File Upload control is somewhat flexible, and there are many similar 3rd-party components out there.
Possibly use Flash like Gmail's email attachment upload component, concept shown this ASP.NET sample on CodeProject.
Also you might consider a Java applet on the client like facebook's Image Uploader; for a similar developer component you might start looking into something like Java Uploader,
All these client solutions are open or make source code available to help with ideas, except Telerik. All solutions are ubiquitous enough to support multiple browsers. Each component allows traversal of the local hard drives using a different UI/technology. I assume custom traversal or configuration is afforded by each to a degree.
Expect the component to be secure first and secondly flexible for the programmer.
Related
I'm trying to come up with a viable (and the simpler the better) solution for a multi-select file upload control. Normally this would be a breeze except for a few things...
The user needs to be able to literally select multiple files in the dialog, NOT one by one.
Can't use open source code. (But Javascript/JQuery is OK)
Cant use a third-party library the Microsoft doesn't support.
(Please don't bother with "Why can't you?" comments.)
I don't have a lot of experience making my own controls. (And I'd assume if there was a simple way to do this just by modifying the "Open" control, it would be an easily found tutorial.)
Thanks.
EDIT: To answer some questions...
I haven't tried much of anything outside of researching. Not really sure of where to start with all these limitations.
I can't use HTML5. In fact, I need IE7 compatibility. So no multiple attribute.
How about Telerik's multi-file upload? I believe they are an MS certified partner.
-J
If you want to make a customized multi-file uploader control yourself, you have to build a rich file explorer using java script client side and then upload files using ajax technology. I think all multi-file upload components use this method. If you can't use open source or third party components, it seems you have to make it from scratch.
i'm trying to do a download manager just for learning cos i'm new in windows programming,
could someone tell me how to monitor most common web browsers,
i'd like to implement something like:
http://www.iwisoft.com/videodownloader/video-downloader-features.php
everytime you visit a web page in common browsers detects all video files in the web page and allow you to download or not the file, any idea how to do that without building an app for every browser, which is the best language to do it c#/vc++/managed/unmanaged,
i'm learning and using a mix of all to do other parts like download files, add rules to firewall or modify the registry
thanks a lot
I don't really know a neat way of doing this, but you could try the following :
Enumerate the name of the current window using GetForegroundWindow.
Check if the name you get using GetWindowText matches the usual name of the browser.
If it is a browser, moniter the clipboard and check for hyperlinks
then do your download stuff.
I program in C++ and assembly, but I wouldn't be able to advice you on the programming language since I don't have any experience with C#. But since you are new, I would suggest starting out with basic stuff. As pointed out in your comment, this is not something that can be achieved easily.
I have an web based application. The content for the Home page has been currently mentioned in the HTML code for the Home page using , and tags. To change the content anytime in future, it needs to be changed in the HTML code. :(
Is there a way that we can pick up the content from some external place and get it reflected through the website. This ways, any change if required can be made at the external location without referring to the application's code.
Please advise if there is any solution for it.
Thanks.
You can
Use a database
Include external files using Server Side Includes
Read external files and write their contents and an alternative method
Sounds like you're looking for a Content Management System (CMS), which will allow your content editors access to modify only specific blocks of a page that you specify.
There are a ton out there to do what you want, so you don't have to start from scratch. Just Google 'CMS'.
Although I haven't used it myself, DotNetNuke is a popular one these days and has a free version.
OK, so we have an online downloads store accessed via our software. Recently we've had requests to allow downloads via normal browsers and it's fairly easy just to slap a download page on. The problem is that it would be confusing to people having two download links, one for the software and one for their web browser, so we want to differentiate between the two and only show the relevant download link.
From what I've gathered, the .net WebBrowser component is the same as IE and uses the same User Agent, so we can't use that unless we subclass the WebBrowser in the software to make it use a specific User Agent. It's the more sensible option, but we'd have to roll out another updated version, which is less than ideal.
Are there any other ways to tell if someone's accessing a site via the .net component? My only other alternative is to copy the store to a different address with the different download links and send people there. Again this is doable, but not ideal.
Check if window.external is null. IE implements window.external to have methods like AddSearchProvider where most of time WebBrowser.ObjectForScripting is null.
I'm not sure if there is any better way to do this, but here is one idea... The WebBrowser control has a property Document that gives you access to the DOM object representing the loaded document (after the page is loaded). This object has InvokeScript method that you can use to run some JavaScript in the loaded page.
You could write a simple JavaScript function, say hideWebDownload() that would switch the view to a view used when the application runs locally and invoke it from your WinForms application that hosts the WebBrowser control:
webCtrl.Document.InvokeScript("hideWebDownload");
The default view of the page would show the download link for web and calling this function in the local application would switch the view to local download link.
Have your software pass in an invisible (to the user) value in the querystring of the URL.
Trivial to look if that's present.
How can we print using print document so that we can control the printer paper size?
It must be controlled after web
hosting is done without the print
dialog popup or javascript popup.
It should print on the client's printer
after webhosting without the print
dialog option and setting the paper
size.
It should be done in C# .net
As a user I don't want that when I enter a site someone to change my printer's settings or to take control over my printer.
For security reasons I hope this is not possible.
Your best option is to generate PDF-files with the appropriate siez in it. A printer should choose the correct page-size based on that unless the user manually changes it in the print-dialog.
Cirrcumventing the print-dialog is a security-restriction, ActiveX or a firefox-extension is your only alternative then, which might be okay on an intranet-based webapplication.
The only way that I've been able to have this amount of control over the printer client side is to create an ActiveX component that would handling the printing interface and go from there. It's not cross-broswer not the cleanest solution; however, it's the only way that I've been able to manage paper size. I looked into a CSS #print options but was not able to find one that could truly control the size.
The only other possibility is to look to see what printing capabilities something like Flash or Silverlight have. I'm not familiar enough to say if they do or don't have what you're looking for; however, it may be another option.
I believe a Java applet has the ability to set paper size if you grant it the proper privileges. I think your users will almost certainly have to jump through hoops for this to work...
Maybe too late but I'm adding for future reference; you could use a kind of download/print manager utility. Imagine the torrent magnet links, you click a link and a .torrent file opened by torrent client, it reads the necessary info and do the rest at client site.
So you have to write a little utility which one recognizes these 'print jobs' from your web site. You click a [Print Invoice] link and browser downloads a unique .print file and the utility captures it.
The .print file has two parts: 1. Header and 2. The file (pdf/jpg/any). Header contains predefined printer/paper size/orientation/etc or just asks for user input. And then prints the file from 2. part/body.
You may also queue the print jobs and manage them as well.
You have to install that utility; define a protocol like http:// or ftp:// to capture print links from the utility. And set printers/papers/etc for specific jobs like invoices/color printings/etc.
These will be what I'll do when I port our winforms app to web. Plus If you are on a LAN environment then you would print the things from the web server to network printers.
I have looked into this before, and the only way to force things like portrait/landscape etc, is to get the user to install an ActiveX control (or similar).
Javascript or CSS alone cannot do it.