Asp.Net Publishing Issue - asp.net

I am publishing my website in asp.net but i am in a small problem i will explain you my problem with screenshot
This is my Solution Explorer as you see I have 2 ApprovalListing pages one in my Employee Folder and Other in my Order Folder
Now i publish my website using Publish Wizard and used Use Fixed naming and Single Page Assemblies
and Now the problem is as i have told you i have 2 ApprovalListing in my Solution and when i publish my website which dll is my EmloyeeApprovalListing and OrderApprovalListing. Can any 1 point out how can i check that out ?

Open each corresponding aspx page and look at the reference on the top. It will say which DLL is used by each page.
For example, one page will say something like:
...inherits="ApprovalListing, App_Web_about.aspx.cdcab7d2" %>
where cdcab7d2 will correspond to one of the DLLs

Related

Hiding MVC pages in web.config

I am taking over an MVC project for which there is no source code. All I have to do is remove all the existing functionalities of the MVC based website leaving just one page alone. Right now, I have decompiled the dll from production and I have a 'not so useful' type of code in my system which needs to be wired up completely.
I am wondering if it's possible to hide all the pages and hyperlinks through web.config just leaving the required page as such? The website looks like below:
I want to keep only the "State Fact Sheets" page removing rest of the pages. is it possible at all to do this in web.config file?

Master Page does not exist error in an irrelevant directory

I have a ridiculous question about master pages in asp.net.
I have several pages under a project and all of their master page paths are determined like this:
MasterPageFile="~/zFrame/InterfaceMaster.master"
However when I run the project, I see the page giving following error:
The file '/interface/Intertech.Interface.InvoicePayments/zFrame/InterfaceMaster.master' does not exist.
Normally the master page must be in the "zFrame" directory. the second directory does not contain master page.
The whole site used to run perfectly until a few days ago. and only some of the pages come up with this error
Think you need to convert Intertech.Interface.InvoicePayments to a web application in IIS Manager
As an advancement, I could access the IIS. There are other projects listed as different folders under the "Default Web Site". All are working fine except the project "InvoicePayments". I would love to convert it to application, but others are not converted to applications and still working fine. I'm totally confused.

site.Master file does not esist

Probably a silly question, being new to development, I am following tutorials and find references to a site.Master file in many of the tutorials I have come across. Is this something that is autogenerated or must I create this file myself? I have access to vs2010 and 2012 and I don't see a site.Master file in any of my projects that i have started. There is however a _layout.cshtml file. I only ask as in every tutorial that mentions this file, doe not mention creating it, just that the file exists.
Here is the deal.
You are probably reading tutorials about MVC or MVC 2 where the view engine is aspx and master pages still are used as a template.
Since MVC 3 a new engine is introduced: Razor. Also this _Layout.cshtml page takes the role of Site.master (master page). With Visual Studio 2010/2012 if you select an MVC project it defaults to Razor syntax and includes _Layout.cshtml as a Shared View.
You can still follow these 'old' tutorials, but mind this difference and act accordingly when recreating the steps.
It could be auto generated if the template you created your project from included a master file. Look in the Solution Explorer (If the solution Explorer isn't visible, hit View -> Solution Explorer) and see if you have a file in your site that ends in the extension ".Master". If not, right click your project in the Solution Explorer then click Add New Item. On the left select your language (Visual Basic or C#) then in the right select Master Page. Give it a name at the bottom such as site.Master. Then click Add. You'll have a master page.
After that, you'll probably want to hook up your other pages to use the new master page. But I'll leave that to your tutorials.
ASP.NET Master Pages: http://msdn.microsoft.com/en-us/library/wtxbf3hh.ASPX
site.master files are usually auto-generated for you when you make a new default ASP.NET website in Visual Studio. Depending on where are in your project, you may need to create one yourself, if Master Pages is the route you want to take. They aren't mandatory, they just make things easier IMO.
MVC has no concept of a masterpage, and site.Master doesn't exist. If you find a reference to site.Master on a tutorial you are using 'regular' ASP.NET (or, as I like to call it, if I'm trying to be polite 'old-fashioned' ASP.NET), not ASP.NET MVC
Yes , It is auto-generated when you create a new ASP Website Project in VS

Extract aspx pages from precompiled asp.net web site

Is it in any way possible to go from a pre-compiled asp.net site and back to something resembling the original code (with markup that I can update in aspx and ascx files). I have lost the original code and is left with the precompiled version of the pages. It is possible to disassemble the dlls but the code is very hard to figure out and I get many different error messages, when I try to update and rebuild the dlls that contains the precompiled aspx and ascx pages.
Reflector is your friend, or ildasm.exe if you know how to read MSIL. And next time use a VCS to put this code under source control to avoid uncomfortable situations like this.

How to consolidate ASP.NET master pages across applications?

First shot at throwing a question on these boards so hopefully I can get some help, here goes:
I am working to start up the .NET practice at my client. We have 5 small scale .NET applications in place currently with a few them of them live into production. They're mostly small reporting pieces with some data entry/business logic functionality. Each of these applications is currently using the identical master pages.
What I mean is that there is a copy of the same master page in each application. They are all basic website->WCF->BL->DB tiered applications. So I have 4 copies of the same master page that I have to change when I make a change to it.
The client DOES NOT want to consolidate all of these into a single solution. They like the separation of applications across sites. I just don't want to continue dealing with the hassle of multiple updates for common elements (which there will be many more of across these applications).
The code is all stored in team foundation server. We also do NOT want to compile the master page into a .dll and deploy it.
Can anyone please make some suggestions as to how I can maintain a single copy of these common files (master, .css, etc) across my multiple applications.
thanks in advance
You might want to look at Sharing Master Pages in Visual Studio.
If that is no help then you could try using Build Events in Visual Studio. I would pick one of the projects to be my "Main Project" and only edit the master page from that project. When you build the project it would run a command that would copy that master page(if it had changed) to your set locations.
The client DOES NOT want to
consolidate all of these into a single
solution. They like the separation of
applications across sites. I just dont
want to continue dealing with the
hassle of multiple updates for common
elements (which there will be many
more of across these applications).
The code is all stored in team
foundation server. We also do NOT want
to compile the master page into a dll
and deploy it.
You eliminated the only two real options there. What all is in the master page? Would it be possible to extract the HTML UI elements to a single template or series of template HTML files and import those dynamically into the master page? You could then relocate the common HTML to an arbitrary URL and have the master page for each application pull it in dynamically.
Edit: I lied. You could also use a VirtualPathProvider like Sharepoint does to store the master page in a database or some other directory, but beware that VirtualPathProviders do not work in MediumTrust environments.
See:
http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx
If you are using Web Applications (compiled into a dll) rather than Web Sites you can do the following:
Right click on the folder you want to store the master page in
Select "Add Existing Item..."
Browse to the master page on the file system, and select both the .master and the .master.cs files.
Then, rather than clicking on the "Add" button, click on the little down arrow to the right of Add, this will bring up a little menu with the options: "Add" and "Add As Link"
Select "Add As Link" this will reference the file in your project, while leaving it in the original location in your dev environment - this allows you to edit it in either application, while keeping it up to date in the other applications.
Obviously if you edit the code behind, you'll need to re-compile the other projects before you deploy the changes to those sites.
This isn't available in web site projects as they rely on the file structure to work out what is in the project.
EDIT: Missed the css part. Obviously you won't be able to serve those files, so this should only work for the master page.
Don't know your scenario, so
IF you can control the DNS / virtual directories to the applications you could use a format like this:
c:\inetpub\wwwroot\Application1
c:\inetpub\wwwroot\Application2
c:\inetpub\wwwroot\Application3
c:\inetpub\wwwroot\Application4
c:\inetpub\wwwroot\Application5
and have your Master page at c:\inetpub\wwwroot\master.Master,
c:\inetpub\wwwroot\master.Master.cs,
c:\inetpub\wwwroot\master.Master.cs.designer
Then you could reference the single copy of the master page from /../master.Master. I gave this a quick shot with a precompiled master page to make sure I could reach back beyond my root. You might have to give it a shot to see.
We use our source control to create links to the shared files in all the places that we need it. So if you edit in one place, you just need to do a get latest and it will appear in the other places you have linked it.
I ended up going with the VPP route. I created a virtual path provider and built my master page into a DLL and this is working. Now I have a massive problem though in that a Content page whos master page is late bound through the codebehind throws validation/formatting hissy fits because it thinks its should be a stand along page. my CNTRL + K, CNTRL + D has broken on every page where I'm now sharing my master page. This is extremely frustring for me and the team

Resources