Is it OK let the designers to download the cshtml files (MVC 4) from a published site and modify the files for layout/styling? (And later the developers' cshtml files can be replaced by the ones from designers)
If I remember correctly, the old version of Asp.Net webform may change the .aspx files after published. Will .cshtml files be untouched after published.
cshtml files means C Sharp HyperText Markup Language, e.i its html with C Sharp Code (Razor Syntax).
Offcourse your designers can download the cshtml file(mind it you cannot download cshtml files from a published website) edit it and reupload it. but make sure they dont tinker with the razor syntax.
Yes cshtml files can be modified to change the layout/styling on a published site.
Related
I have a .Net web project. I want to organize my solution explorer and my pages. Because there are 4 type of users and there are many pages. I want to create folders and keep some of the files in them. I've moved the page files into folders but app does not work. So what should i do?
You need to change the Page Title at the very beginning of your web page accordingly. What used to be Inherits="Myproject.MyWebPage" is now Inherits="Myproject.MyFolder.MyWebPage"
Also, aspx files have a Mypage.aspx.designer.cs file underneath and its namespace is namespace Mypage{ but it now should be namespace Myfolder.Mypage{ that's why your code behind has red lines because it can't verify your aspx page via the designer file.
I have donwloaded the Nuget package, MvcSiteMapProvider.
In one project it only downloaded the razor views. In my other, I have both the Razor and ascx files. Also in that project it is default to using the ascx. I want it to use the razor pages instead. Does anyone know how to switch this.
When the NuGet package detects no files with a .aspx extension in your project or detects any files with a .cshtml or a .vbhtml extension, it will install the .cshtml templates. Unfortunately, there is no reasonable default when both .aspx and .cshtml extensions are detected or no files with the above extensions are detected, so this is a "best guess".
To install the Razor templates, you just need to delete the .ascx templates and copy the .cshtml templates from here.
I've been working with webforms and recently started to work with mvc. With webforms, when we use to push to the qa/prod server, we alway copied over the files. leaving behind the .cs files, so just the .aspx, bin folder, along with associated js/css files would go.
with mvc, if we are copying the directory over from our pc (where we develop), what files are needed, do we need the .cshtml files for example? I just want to avoid having to push all the files if they are not needed.
They are definitely not all required. What you are going to want to do is setup a way to publish, this ranges from doing a "bin deploy" to feeding in ftp settings and using a "single click deploy" approach.
What it all boils down to though is this. You will need
A bin folder with every relevant .dll
A content folder with relevant images and css files
A script folder with relevant .js scripts
A views folder with nested folders for views with relevant .cshtml files
A .webconfig file in the views folder and also one at the very root
The packages.xml file at the very root
The global.asax file with markup pointing to the application starting in global.asax.cs
What this excludes is every single .cs file. These will all be composed into your projects .dll. So if you are developing FunWebApp, then all your c# will be rolled into FunWebApp.dll in your bin folder.
Use the Visual studio "Publish" option available on your UI Project. This will generates all the required files you neeeds includes, bin folder, Views folder(which will have the .cshtml files),Content folder,Script folder, Config file(web.config) etc.
Right click on your project and select "Publish". You will be shown a wizard where you can define what kind of publish you want. You have different options like FTP, File system etc.
You will not see the Controllers folder / Other class files because code inside that folder is compiled to your assembly which is in the Bin folder
I am quite new to .NET development and I am just wondering how does it work?
My undermentioned points are:
While developing ASP.NET application, under the project we have files like:
pagename.aspx
pagename.aspx.cs
pagename.asp.desiger.cs
After adding certain functionality to pagename.aspx page, assuming I have the development required web application (this is not my concern, what is developed)
Now I'm going to deploy this application, I use web deployment MSI which creates the required files in the one folder called folderdelopyed.
This folder contains the files required to support this application but interesting does not contain pagename.aspx.cs and pagename.aspx.designer.cs files.
My question is if folderdelopyed does not contain .cs file, then how does it work to run the segment of code which I have written in this file called PageName.aspx.cs?
The code in your cs files gets compiled into a dll.
For Web Application projects this is one dll
For Web Site projects, this is a dll per page.
All of the code is now in the dll's in the bin folder of the website.
You can use a tool like ILSpy (http://wiki.sharpdevelop.net/ILSpy.ashx) to look inside the dll's and see your code.
In the old days, for classic ASP, the script used to be embedded in your page - a mix of code and HTML, and was interpreted at runtime.
I like the new way more :-)
ASP.NET code is compiled into Dynamic-link library files, also known as DLL files.
The code you write in your code behind, which is the files with .cs extension, is compiled and put into whole new file, with .dll extension - and that file is copied to the server, to the BIN folder of your site.
Depending on what project type you choose, it's possible to have several DLL files for the web application, changing in every build - see dash's answer for more details.
On every .aspx page you have referece to what DLL file to use, as the very first line. For example:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="pagename.aspx.cs" Inherits="MyNameSpace.pagename" %>
In this example, the Inherits part determines what DLL to use. How? By the namespace, which is also the name of the DLL file.
When the above .aspx is requested by a browser, the .NET engine will go to the BIN folder, look for MyNameSpace.dll and in there look for class called pagename that inherits from the base Page class - all the rest is typical life cycle of ASP.NET page.
let me to say you something more Amazing.
you can hide your aspx file too.and put their content in to dll as same as your cs file put in dll.
you can make k aspx that just contain an address to the ddl file and no html body :D
that was greate!!! not only you can hide your cs file, you can hide you aspx file too :D
i have some files with extension aspx.cs.
i tried opening them with visual studio c# 2008.
but all that opens is the code page, and not any design page.
what should i do?
i have to work on that project.
how to open those files, in which program/software?
please help.
Open the project .csproj or .sln file if there is one
The design files end with an extension aspx. The aspx.cs files are the code behind files and do not contain any design elements. Open the .aspx files in visual studio and you will have the proper design page.
The aspx.cs files only contain the code living behind the aspx files (that's why they are called code-behind files). If you want to be able to see the design you have to open an aspx file with the same name.
For example, if you have customers.aspx.cs, it contains the code-behind of a page called customers.aspx.
If you only have aspx.cs but not aspx, then you have a problem, as probably you lost files of the project.
Hai!!
.cs files are code files .aspx files are desidn files where you can switch from asp tages to asp design view but .cs files are c# code file that has no design
Happy Codding
Jay
For the Design File in .net Extension is only .aspx, Please open .aspx files instead of .aspx.cs Files