I have a setup where my Razor views are in one project (say, Project X) and have two other projects that use those views (an admin website and a user portal website). The problem with this setup is that editing a Razor view in Project X requires stopping and starting the debug session to see the changes on the websites.
Is there a problem with my setup, or is there some way I can edit the Razor views without having to do a full recompile?
(Note that editing a Razor view located directly in either of the web projects shows updates without having to restart)
Related
I need a way to let non-developers manage partial html pages within an asp.net mvc core app so the developers aren't being bothered with simple content updates like text and image swaps - ideally using wordpress tools / plugins we already have (ie. divi or some other method) to manage those html partials.
Mainly I want to be able to control the layout (header, footer, nav) with asp.net core but load the content either within or external to the application for each page.
Ideally when we make changes to these partials, we don't even need to rebuild the app and deploy, we can just save / publish the files and move on, leaving the developers focused on their application jobs and the web updates can be handled by designers and project managers. I need suggestions on best practice workflow in this situation and tool recommendations - would I need something like a Joomla or Drupal or would Wordpress (ideally) be able to author partial pages that the asp.net core app can then link to and display?
We are using wordress plugins so non web developers can build and manage web sites and pages with little to no coding. We also have a few web developers who are programming applications needed by the org. These developers are getting requests that don't / shouldn't require a developer to complete, but some of these pages live within an older asp.net application we are updating.
You have a number of options
Partial Views
The Views in ASP.NET are not compiled during deployment. You can edit them on the production server real-time without affecting any deployment process. They are compiled real-time. All you have to do is press ctrl-F5 in your browser to get the latest views from the file system.
Options for Workflow
Refactor your content so that the partial views contain only content that is to be edited by the non-developers.
This would mean that the partial views that the non-developers edit contain only html and no razor-type code.
If you really don't want the non-developers touching the source code directory, including the views, you can have the content that they provide stored in a database.
This way in your controllers, you can check the database for the content the non-developer has stored, and save it in a ViewBag variable. That way the non-developers are not touching any of the source code
Content Management
If your non-developers are going to have access to source code files, why not just five them FTP access. Updating Views real-time is perfectly fine. Or you can look into using Subversion source code client to keep a version history
We have an existing ASP.NET CORE App with lots of controllers and views (with knockout for 2-way-binding).
Now the requirement is to build new pages (views) with Angular 4 but the rest of the App should stay unchanged.
The management says it should be made like previous knockout extensions which integrate seamlessly in ASP.NET CORE views. This means each page should be a seperate Angular 4 SPA. This requires that routing has to be done with ASP.NET CORE and not Angular 4.
Question: Is this feasible? If yes, how?
Question: Are there better strategies to extend an existing ASP.NET CORE App with Angular 4 parts than this approach?
EDIT:
What I don't understand so far is how to provide routing by ASP.NET CORE in combination with Angular4. In ASP.NET we use _Layout.cshtml for common layout code including a #Html.Partial("_Navigation") for navigation and #RenderBody() for rendering the views. We want to use razor partial views as for the Angular templates. This excellent article describes how.
But how can this be done with ASP.NET routing?
I have found a solution that works for our requirements. For each "mini SPA" I created the necessary files (NgModule, main.ts) to bootstrap them. Then I add a Controller that delivers cshtml-views that contains the load command for the different "mini SPAs". Referencing them in ASP.NET navigation worked like a charm!
One of the key purposes of Angular is to write single page applications (or SPAs). And that does NOT mean what it sounds like. The idea is that the user can seamlessly move from "page" to "page" in the Angular app without hitting the server to ask for the next page. So from the servers perspective, it is providing a single page down to the client ... and then Angular takes over and displays all 10, 50, or 100's of views.
Retaining the ASP.NET routing and rewriting each page in Angular would be pointless.
For a more concrete example, say you have a Product Management application. In Angular you would write every view: Product List, Product Detail, Product Edit, Product History, etc. When the user accesses the app ... all views are downloaded. Then the Angular routing moves the user between these views without needing to hit the server again for another page.
If each of these was an ASP.NET view, then ASP.NET would serve the Product List page. Then if the user moves to view details, they'd have to wait for the server to serve the Product Detail page. Then if the user returns to the Product List page, the user would have to wait for the server to serve the Product List page again.
So my advice is to tell management to take an Angular course (I have one if they are interested) or leave it to the developers to make the appropriate architectural choices. :-)
Seriously though ... it seems like there would be a large expense for very little benefit if you were still planning to serve every individual page from ASP.NET.
And maybe that's the answer here ... ask them what they are truly trying to achieve with a move to Angular.
I have 2 web application projects. One is my asp.net MVC app and the other is for the admin related functions which is asp.net web forms Dynamic Data. My MVC app would be the main site, but I would want the webforms to work under an Admin folder of the MVC site.
While debugging the application, I would like the "/admin/Default.aspx" link on the MVC site to link to the default page within my Dynamic Data site. How do I accomplish this? I know I can test each project independently.
Within the visual studio project, you can right click on a folder and select "Convert to Web Application" which resolved my issue.
The easiest way would be to run them both in separate virtual directories and use Url Rewriting to push requests for the root to the public site. You can nest ASP.NET applications, but that generally requires quite a bit of fussing with the configuration file to dodge inheritance issues.
You could achieve this behavior via your IIS-Manager. Click on the Website, navigate to the folder you want to behave like a separate application and use right-mouse click and press "convert-to-application".
How to add or open the asp.net pages from inside sharepoint?
I found many info on the web about that, but they all fail or they are not clear. I appreciate your help :)
Your question is not clear, but if you want to customize look'n'feel of SharePoint page you should use SharePoint Designer.
In case you want to create some additional functionality from scratch the easiest way is to create a custom web part and then add it to a SharePoint page.
I think you want to include an aspx page to call either using an AJAX include or to be able to use the MOSS Object Model without having to add references etc?
if so then the following steps are necessary:
navigate to 12\layouts\
create a folder for the asp.net files
put the inline code files in
From sharepoint you can add a page viewer web part and reference it with the following url _Layouts//Filename.aspx
This technique will only work with inline code, if you wish to compile your code then you would create the site as normal and then add an application folder within the virtual directory of that particular site for example my site is called intranet:
navigate to c:\inetpub\wwwroot\wss\intranet
add your asp.net folder to this as a sub folder
in inetmgr right click the folder and create an application for it (use the same app pool as the sharepoint site)
ensure ALL DLLs from the sharepoint site bin folder exist within the apps bin folder or it will throw an error.
However, I would only ever use these methods as proof of concept and would ultimately use web parts, custom features and workflows to carry out the same functions.
We have several asp.net MVC apps in the following setup
SecurityApp (root application - handles forms auth for SSO and has a profile edit page)
Application1 (virtual directory)
Application2 (virtual directory)
Application3 (virtual directory)
so that domain.com points to SecurityApp and domain.com/Application1 etc point to their associated virtual directories. All of our Single Sign On (SSO) is working properly using forms authentication.
Based on the users permissions when logging in a menu that lists their available applications and a logout link will be generated and saved in the cache - this menu displays fine whenever the user is in the SecurityApp (editing their profile) but we cannot figure out how to get the Applications in the virtual directories to display the same application menu.
We have tried:
1) Using JSONP to do an request that will return the html for the menu. The ajax call returns the HTML with the html; however, because User.IsAuthenticated is false the menu comes back empty.
2) We created a user control and include it along with the dll's for the SecurityApp project and this works; however, we dont want to have to include all the dlls for the SecurityApp project in every application that we create (along with all the app settings in the web.config)
We would like this to be as simple as possible to implement so that anyone creating a new app can add the menu to their application in as few steps as possible... Any ideas?
To Clarify - we are using ASP.NET MVC 1.0 since these apps are in production and we do not have the okay to go to ASP.NET MVC 2.0 (unfortunately)
Have you thought about using Single Project Areas?
Areas allows you to partition your application into discrete areas of functionality. It helps make managing a large application more manageable and allows for creating distinct applets that you can drop into an overall application.
There is a version of Areas that works in MVC 1.0 available here: http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx