ASP.NET MVC browse folder/file dialog - asp.net-mvc

There is a page on my site that asks the user enter in a path to a folder/file. This folder/file exists on the local machine. Instead of having the user type out this directory, I would like to have the user choose the path via some sort of pop-up where the user can browse folders/files on their local machine. Once a folder/file is chosen in the dialog, I would like the path of this folder/file to be displayed in a text box ready to be submitted to the server.
I have searched all over Google and this site in search of a solution that fits my particular needs. Please remember, I need this to work for both folders and files.
For example, instead of having the user type in "C:\Users\Me\Desktop\MyFile.txt", I would like them to be able to browse for this in a dialog. They should also be able to select a folder like "C:\Users\jselesky\Desktop\". I am using ASP.NET MVC3 with C# for my web site. Thank you.

If you want path and name of existing file then you can simply use <input type="file"> in HTML.
And if you want file path and name for saving a file.. then Me too searching for the same answer...

Related

Login and registration page path in ASP.NET MVC

I am a newbie in C# programming and web development. Kindly let me know how I can find the code files for the login and register page in ASP.NET MVC.
I created this simple web app using this crash course; https://www.youtube.com/watch?v=BfEjDD8mWYg&t=909s.
This is the screenshot of the page I want to locate and alter. I want to change the text next to the login and registration forms.
Looking forward to getting a reply from anyone who can help.
Thanks in advance
I tried looking in all the files, like the css file and all the files in the views folder, but I could not find the file I want to change the text on the registration and login page.
I check the video you provided and find that he created a project with Individual User Accounts, So the project will generate Register and Login page Automatically, But you can't find these pages in your project.
If you wanna find these pages, You need to Scaffold Identity:
From Solution Explorer, right-click on the project > Add > New
Scaffolded Item
.
From the left pane of the Add New Scaffolded Item dialog, select
Identity. Select Identity in the center pane. Select the Add
button.
Select pages you want to create, Here you can choose Login and Register page, Then To use your existing data context, select at least one file to override. You must select at least one file to add your data context.
After you finish these steps and generate page successfully, You will find these pages in Area/Identity/Pages/Account/... ,Then you can edit them.
More information you can refer to this Docs.

Launching an application from a browser using HTML?

I have been asked by our iPad Admin. to create a link on our intranet that will open the application Filebrowser on student's iPads. Is there a way to code this in HTML or HTML5? No icon needed, just a link to open from browser (Safari) on the iPad.
I'm a novice coder, really a front-end designer who often has to find ways to code something so any help is greatly appreciated.
Generally no. See: How to run an external program, e.g. notepad, using hyperlink?
That being said, you can open a "file browser" when you click on an <input type="file" /> form tag, to browse and select a file for upload, but I gather that is not what you want.
You can also create a link to a local file, but you'll run into permissions issues. See: How can I create a link to a local file on a locally-run web page?

Navigate between pages in Electron app

In an Electron application, what is the standard way to navigate to different pages / locations when a link is clicked?
I tried creating
<a href="/profile.html>profile</a>
and an HTML file named profile.html, but clicking the link just takes my app to a blank page.
What is actually happening when the link is clicked & what is the right way to do basic links?
Just use a relative link - this will work (note no slash at the beginning):
profile
This is because Electron uses local file:// URLs which map to your file system. If you link to /profile.html that will be looking for the file in the root of your drive, and you probably want it to be loading the file from the same directory instead.
Also if you put the profile.html in a directory called pages you could access it like this:
profile
Electron is designed to work best as a single-page application.
Clicking a link shouldn't load a new page but should manipulate the DOM to changes the contents on the same page.
If you use jquery you could use Tabs to swap between content https://jqueryui.com/tabs/
<a href="./profile.html>profile</a>
use ./{filename} to access the file in the same directory

how to serve static files via MVC after login (I am trying to add an angular mini-SPA to my large MVC project)

Looking for suggestions on how to host static files through an MVC app.
I have an MVC SPA (basically a bunch of static html, js and img files). I want users to be able to access these static files only after they have logged into my MVC application. I am running on a windows server platform, using IIS.
Currently I am doing this:
RouteTable.Routes.IgnoreRoute("AngularApp/{*path}"); //to serve up angular files from AngularApp folder
However this has a number of problems.
I don't really want to ignore the route, I want the MVC controller to check if the user has permissions (like my other controllers do), if not redirect to login page and if so, then instead of sending them to a view, allow them to load any files in a particular folder or subfolders. But the folders these files load from need to be a different path than the route URL requested. For example I don't want users to have to go to mysite.com/angularseedapp/deploy/app/mypage.html but rather if they request mysite.com/a/mypage.html I want it to serve up the file from there.
This seems simply a matter of being able to have MVC redirect and fetch files from a different folder, but I have no idea how to do this.
Could someone knowledgeable about MVC please give me a step by step simple way to do this? When I try to fetch files outside the views folder this seemingly simple task results in various permissions and other kinds of errors because I don't know how to do it correctly.
Thanks!
P.S. To clarify, I know how to get my controller to check permissions and redirect, to any single file in the views folder, but how do I do it for a whole folder of files and directories in a higher level folder? I want to map the route, have it go to a controller, then instead of going to a view I want it to take me to static files. I suspect there is some way to use maproute() in global.asax to help me do this but I do not have a lot of experience with that.
I may be oversimplifying but I usually select the application in IIS Manager and then select Mime Types, they add mappings for whatever types you want to map statically. I've done this for HTML and JSON files before and it worked fine. Use type = text/javascript or application/json etc.

Using Application Pages for List Forms

I'd like to use an application page that I created in the _layouts folder as the new document form for a document library in SharePoint.
When I attempt to do this in SharePoint Designer, I have to browse to the file but it doesn't let me browse to the _layouts folder.
This functionality will be list specific so is there a way to make this connection on a per-list basis? My only idea right now is to use a redirect page.

Resources