ASP.net MasterPage.master does not exist - asp.net

I am having a problem while publishing my website on the IIS server, i don't have direct access to it so i have to rely on some one else to configure my website on the IIS.
however when i upload my website this error comes up:
Line 1:
<%# Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>
Line 2:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
Parser Error Message: The file '/server/website/MasterPage.master' does not exist.
my masterpage is in the root folder of the website and default.aspx is on the root also, i have searched on internet for answer but the best i have found is changing MasterPageFile="~/MasterPage.master" to MasterPageFile="./MasterPage.master" but haven't tried yet till Monday.
i would appreciate your help.

(i)Make sure that the user account that the server is running under has permissions to access that directory.
(ii)When using "~" in a file path, make sure that the current application deployment believes the root directory is the same as it was before.
(iii)Open IIS, right-click on the virtual directory folder for this site, and selected "Convert to Application." Refresh and check again.

I just had this problem and got it fixed. How? I moved all the files up to the root directory of my website.
Formerly, I put them in a folder inside another folder in the root folder. I am still wondering why I did that :D Anyways it is all fixed now and running without showing any annoying 'Parser Error' and it is perfectly reading and updating the database accurately.

Related

CodeFile and Inherits at first line affecting Aspx

I developed a simple web application on my localhost successfully. The next step is to port over to a remote server. IIS Manager has been configured and a virtual directory has been set. I have copied 2 files over, the page VB and .aspx file.
On the top of the aspx file, I have <%# Page Language="VB" AutoEventWireup="false" CodeFile="ASPWiki.aspx.vb" Inherits="ASPWiki" %>'. When I try to run, it shows Server Error: 404 File or directory not found.
When i changed it to <%# Page Language="VB" AutoEventWireup="false"%>, the page can be displayed but the asp controls cannot be bind as the mysql coding is at my vb file. Any advice on what is the issue? Could it be due to the binding i used?
The error only happened after the files were placed in the server.

Modifying code in a website on IIS

I have a basic ASP.NET website running under IIS. I didn't publish it, so it's not precompiled or anything.
I was under the impression that if I modify any of the code under any *.aspx.cs file, the site would compile just-in-time and be updated to show those changes.
However, that's not the case. It doesn't reflect my changes and still runs the old code which is in the websitename.dll under the bin folder. Removing that file throws an error.
Is there a way to dynamically modify and run code in an IIS website?
EDIT: the .aspx files do reflect any modifications, it's the .aspx.cs that doesn't work.
It appears that your site is an ASP.NET web application instead of a website. Look at the .aspx file.
In a web application it looks like this:
<%# Page Language="C#" CodeBehind="Default.aspx.cs" Inherits="WebApplication._Default" %>
In a web site it looks like this:
<%# Page Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" %>
So if your aspx contains CodeFile directive, changes to the code behind will be dynamically picked up.
If it is a web application, you can get rid of the code behind files and any changes would require recompilation.

Parser Error Message: The file '/Site1.Master' does not exist --- but it does

Seems like an easy-to-fix error, but I've been banging my head on this for a while. App works fine in the VS built-in webserver, but not after moving it to the dev server with IIS7.
The default.aspx file refers to the master page in the page directive...
<%# Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MyApp.Default" %>
Site1.Master is in the site's root directory, along with default.aspx. The folder permissions are read to Everyone at this point.
This is an intranet site so IIS authorization is anonymous disabled, windows auth enabled, impersonation enabled. App pool is .NET v4, managed pipeline integrated.
I've looked through this site and others for answers and while others have had the same problem, it was for different reasons.
Thanks.
I had the same issue when we moved our site from one server to another. Our new site is on a VPS at a good hosting company (SoftSysHosting.com) and their tech support created a virtual directory of to where our website/app is. That solved it!
I could solve this issue by removing the CodeFile="..." Option in the first line in the Site.Master:
<%# Master Language="C#" AutoEventWireup="true" CodeFile="Site.Master.cs"
inherits="CG.PresentationLayer.WA.MasterPage" %>
into:
<%# Master Language="C#" AutoEventWireup="true" Inherits="MyApp.MasterPage" %>
I have had a similar issue before. The underlying problem is that I assumed that the paths would stay the same and they did not. Log into your dev server and navigate to your master page. Open the page's properties in Explorer and view the path. Now in a test page on your application run a HttpRuntime.AppDomainAppPath() and view where the app is running from. From there you can see where the mismatch is taking place.
Suppose if you are having the root dir of your website or webapplication as given in the pic like "WebApplication1". This is your root folder of the site.
So just copy and paste the content inside the root folder "WebApplication1" to the "root folder" "/" of the FTP address.
Not: dot not copy with root folder WebApplication1. just copy the content inside the root folder.
Your Dir Structure
==+WebApplication1
====Properties
====Referance
====PropertiesSite1.Master
====Web.config
====Webform1.aspx

is it possible to edit published visual studio asp.net website?

I have published a asp.net website using visual studio. However, I wish to make changes to a web page but I found out that the published site only have .aspx extension files and there is no code-behind .vb file which is like development.
Is there any way for me to edit without republish again? Or can I convert the published website back to original as I do not have any backup for the published files.
Download all the files from the server and use something like a reflector to get the source code from the binary/bin folder.
And for future always use a source control, I use dropbox.
The dll's are just the compiled assemblies of your source code. You can manually update any of the dll's that are updated without going through the whole publishing process again. You may need to make a minor change to your web config file after updating the dlls so as to trigger IIS to reload the latest dlls.
you can change
<%# page language="VB" autoeventwireup="false" inherits="test, App_Web_olnjngph" culture="bg-BG" uiculture="bg-BG" %>
with
<%# Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" Culture="bg-BG" UICulture="bg-BG" %>
and edit source code after that inside file test.aspx.vb

Compile an ASP.Net in a WinForms application

I'm trying to develop an agent/client that will listen to HTTP requests on a given port, and serve a simple ASP.Net page. To that end, I'm using the HttpListener and ApplicationHost classes.
I've added a simple page to my project (mypage.aspx). When it contained all the code in the single file, all worked well (tested it by adding <% Response.Write(DateTime.Now.ToString()); %> to the HTML in the page, and observing the timestamp in the browser).I then proceeded to add a single button to it, add a code-behind file (mypage.aspx.cs) and created a designer file (mypage.aspx.designer.cs) manually. I've added <%# Page Language="C#" AutoEventWireup="true" Codebehind="SearchForm.aspx.cs" Inherits="MyNameSpace.MyPage" %> to the .aspx file and verified all compiles well.When trying to access the web page from the browser, I get the following error:
Description: An error occurred during
the parsing of a resource required to
service this request. Please review
the following specific parse error
details and modify your source file
appropriately.
Parser Error Message: Could not load
type
'MyNameSpace.MyPage'.
Source Error:
Line 1: <%# Page Language="C#"
AutoEventWireup="true"
Codebehind="MyPage.aspx.cs"
Inherits="MyNameSpace.MyPage"
%>
I found out that this means my code-behind has not been compiled, or that that application cannot find the assembly. All my "bin" directory contains is the .exe and .pdb of my original application - no .dll for the .aspx.I tried the solution offered in this question and verified my .aspx and .cs files were marked for "compile" build action - to no avail.My question is: how do I cause an .aspx file to compile in a regular WinForm application? Can I do it, or will I have to resort to adding a web application to my solution?
Check out Cassini. It's a web server that has been build awhile back by the ASP.NET team to allow Visual Studio to debug web applications without needing IIS. It's also a standalone web server. The source can be found on Dmitry's blog at http://blogs.msdn.com/dmitryr/archive/2006/03/09/548131.aspx

Resources