Resource not found in .net - c#

I start debugging the code and getting the following Error.
What could be the cause of following Error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies)
could have been removed, had its name changed, or is temporarily unavailable.
Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Main.aspx
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3655;
ASP.NET Version:2.0.50727.3658

Looks like you do not have Main.aspx or it is in one of the sub directories. Please check the location for the web form.

The application can not find the page /Main.aspx.
It could be that you're looking for it in the wrong location. Ensure it's located in the correct folder structure that you're trying to access.

Related

404 error for files from new project

I have a solution with several projects. One of the projects is startUp. It references to other projects are registered in the reference. I added a new project Adkplatform.mrp.web (right click to add a new project in visual studio).
I want to display a test page in the browser.
For the test.aspx page I get the error:
Server error in the application '/'. We could not find this resource. Description: http 404. probably, the resource (or one of its dependencies) is deleted, received a different name or temporarily unavailable. Review the following url and verify that it is entered correctly.
For the test.html page I get the error:*
*Detailed Error Information:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:3333/test.html
Physical Path D:\WORK\Projects\Test\Software\.Net\Test\test.html
Logon Method Cookies*
I understand it, the search for files in the startUp project.
The test files have Build Action: Embedded Resource
What did I forget to do? In advance, thank.
Sorry, the problem is in our local snippet. It is necessary for the display to call a method c# HostingEnvironment.RegisterVirtualPathProvider for each assembly. For a new project (and new assembly), it not was done.

Identify the ASP.NET version of a site

I debug a site. I need to identify the .NET and ASP.NET version of the running site (on a local IIS).
When I have an .NET Error, the a page is displayed, like this:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: Unrecognized attribute 'requestValidationMode'.
Note that attribute names are case-sensitive.
Source Error:
Line 120: Line 121: Line
122: Line 123: Line
124:
Source File: C:\mysite\opt\root\web.config Line: 122
Version Information: Microsoft .NET Framework Version: 4.0.30319;
ASP.NET Version: 4.6.1038.0
Is there a way to obtain that data in other way than a error message, to be able to identify that versions at demand?
I would like to stress that .NET and ASP.NET are different, and I need both of them.
PS. I would prefer, if possible do not have to modify the code, but rather via IIS...
You can try either of this below
typeof(Page).Assembly.GetName().Version; //ASP.NET Version
This gives your running ASP.NET version which in my case 4.0.0.0. You can find the same information if you expand your Reference folder -> find System.Web dll -> right click and choose properties -> check the Version information.
System.Environment.Version.ToString(); //Framework Version
This gives the version information of the CLR.
.NET Framework - registry check?
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx
Environment.Version
should give you the ASP.NET version

String causing a Parse Error that doesn't exist in code

I keep getting the following parse error:
Server Error in '/' Application.
Parser 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: Only Content controls are allowed directly in a content page that contains Content controls.
Source Error:
Line 1: ate
Source File: /admin/JobCategories.aspx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248
Problem is, the file in question doesn't have that string ("ate") anywhere in it. I did a search in visual studio for it, and found one file containing it.
Strangely enough, the file was shown as JobCategories(1).aspx. I opened it, and tru enough the string was appended to the start of the file. I deleted it, but the error persists, and now when I search for the string in VS I find no results. Tried restarting IIS, rebuilding the website in VS, and restoring an older version of the file from backup that used to work, but I still get the same error.
Only thing done on the file since the last backup was updating a string in the HTML, nothing to do with the code, and nothing near the beginning of the file.
Any ideas? Thanks.

ASP.NET Solution Deployment to Development Server uses Local Paths

Using Visual Studio 2010, I deployed my ASP.NET project to a development server and changed the Web.Config to reflect the development server paths. Some of the code is working, but for paths like images and other files, it seems to be looking at the local path of my machine. I looked all around the code for a hint at where it's using my local path, but I replaced all of them and it's still not working.
The DLLs are all compiled in the correct place, everything is up to date, etc. No problems running the code locally, either. Is there a specific step to ensure the deployment that I'm missing?
Thanks.
Error:
`Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
FieldControl(String FieldType, String Argument, Field ParentField) in D:\Users\mydirectory\FieldControl.cs:132
<more of these>
you adjust your paths with relative path.
A path relative to the root of the site, determined according to the site root (not the application). Paths relative to the root of the site are useful if you keep application resources cross, such as images or client script files in a folder under the root of the website.
his example assumes that path Assemblies folder is located under the Web site root.
"/Assemblies/test.dll"
This type of an error is not saying that it is looking for that local path, thats just where the error is in the code, the compiler is showing you where the issue is: line 132 of that file. Check there and you should see what is triggering the NULL ref.
Solved. My Web.Config was read only so when I changed the path's on the development server it didn't save correctly. Went back in and changed the path's, then made it read only. Thanks for everyone's help.

Upgrade to .net 4 produces breaks webservice .asmx

I was trying upgrading to .net 4 for my WebForms asp.net project.
Now I'm getting this when I try going to the .asmx webservice.
Server Error in '/' Application.
Type 'Chickenweb.WebServ.WebServ' does not inherit from 'System.Web.UI.Page'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Type 'Chickenweb.WebServ.WebServ' does not inherit from 'System.Web.UI.Page'.
It was because I'm using IIS and was using incorrect Application pool. Thanks for all your answers!
It looks like IIS thinks your .asmx file is a .aspx file. You should check the mappings in IIS to see that .asmx is enabled and properly set up.

Categories