My company has a web forms project that we converted to an MVC 3 project over a month ago. Everything works great except for this annoying error that the parser gives on web forms page directives. I'm not sure when this started. I only just started noticing it a week ago, but it could have been there since we transitioned the project.
We followed this tutorial when modifying our web forms project to support MVC 3. The project compiles just fine. Beyond this annoying underline (shown below) there is no problem. Web forms and MVC have played nice together so far. However, intellisense within .ASPX markup does not work while the parser is displaying this error.
Image
The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.
Does anyone have any experience with this issue? I have scanned the web.config as well as unloaded the project and scanned the .csproj xml. I can't see anything wrong but I also don't really know what I'm looking for. Google doesn't turn up anything useful for this error in my situation.
I'm still not sure what was causing this. But a complete re-install of .NET and Visual Studio fixed the issue.
I ran into a similar issue with my ASP.NET Web Site not building and producing the same useless error.
For me, the solution was fixing the capitalization of the sessionState mode in my Web.config:
<sessionState mode="Off"/>
(It may be 9 years too late, but I wanted this answer to be documented literally anywhere on the internet.)
Take a look at Hanselmans's write up and compare your references and web.config:
Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications
Related
I have a project on VS 2019 Windows machine that is fairly small but containing Web Forms. I have taken the whole project folder zipped it and loaded it in directly to JetBrains rider on the Mac. Here is what it looks like currently.
1 Errors on solution
2 What the error says on every web form page
It appears that the System.Web.UI is not accepted on the Mac.
I have looked all over and the forums are telling me to download a package that proceeds it. This does not exist either. How do you replace the System.Web.UI?
WebForms are out of date and cross-platform of the web form is not impossible, but you will need to take into consideration everything that is used on the master page. It is not only a problem with MAC but any other IDE other than Visual Studio. You are better off migrating to the MVC style, it may take time but it appears to be the industry standard. WebForms are supported in Rider, however, you must manually create all the pages that belong with it like the master, and ensuring the routing is the same. Also, it seems to be severely difficult to connect an MVC application with WebForms. You would have to create the same exact style with _layout.cshtml and Site.master page. Seems like an outdated process that works if you want to just make forms.
I realize my question may be something stupid. But here is the problem:
Ive got an ASP.NET MVC web application, it already compiled and it works on the web host. So it has no *.cs files (as I understand they turned into dlls), and clearly it has no *.sln file. I want to run this application using Visual Studio 17, and try to debug it(to see the real code working and get something useful for myself) is it possible? If yes, then please, tell me how to do this. I'd like to google it and find out, but I don`t even understand what to look for.
Thank you in advance.
You can to use Disassembler only for view a namespaces and clases, but not all the code.
I have a VStudio Solution I started in VS 2013.
At that time I included one project, a WebForms project .net 4.5
It worked fine.
Since then I've opened the solution in VStudio 2015.
The current project still works fine.
but I've added a second WebForm project & again .net 4.5.
one big difference is this new projects, although I select WebForm still sets up an MVC site.
In the previous site I can call a page and I get what I expect of Request.forms.
In the new site, even though I've tried to remove everything MVC, Request.Form is always empty.
Why is Request.Form broken and how can I make it work?
You said you removed everything MVC, which IMO means removing dll references but still an MVC project works on Routes and not actual files, creating a WebForms Website instead might be the solution
Request.Form is simply broken.
Request.Param[] replaces it it I guess.
Thank you Microsoft.
I've gone through so many iterations of test of VS 2015.
The answer is simple. Microsoft has yet again f'ing broken something. .Net 4.52 WebForm site or project simple does not work. You can not using Request.Form in the receiving web page. It will forever be empty. The sending page is certainly doing its job.
VS2015 to create a .Net 4 project / site works as expected.
I'm working on a web app using VS 2008, .Net 3.5 and C#. Most of the projects in the solution are either classic asp.net pages with some MVC 1 in the mix, the rest is shared libraries. The solution is one that is some 5 years old and has gone through a variety of developers working on it and clearly has some performance and architectural issues.
Previously, I've been working on the project using VS 2008 on a Win XP machine, but have just transitioned over to a new box using Win 7 Ultimate. To do so, I've installed VS 2008, asp.net 3.5. To support future work on the solution I've also installed VS 2010 and asp.net 4.0.
Opening the solution on the new box with VS 2008 works fine, and it builds without error. However, when I attempt to run it with the debugger, I get the following message:
"There is an error in web.config. Please correct before proceeding. (You might rename the current web.config and add a new one.)"
I think it's clear that there is some sort of environmental issue regarding web.config on the new machine, but the error message is not "helpful". Adding a new web.config is not an option as the existing one is quite long and involved (too much to post here).
I'm hoping someone has a suggestion or two about where I might look for missing elements or changed configurations that might produce such an error message. Lacking that, I'll revisit this post and provide the web.config in the hope that will elicit further help.
So I don't know if you ever found an answer to this, but I ran into it in VS2013 today. Oddly, it would work if I had the web.config open in an editor window.
For others who may see this error I was able to clear it in VS2013 by deleting the \bin and \obj directories.
After that, it worked fine again...
To maybe give you a better idea of what the web.config problem is, I would follow the suggestion of renaming the current one and adding a new one. You can use a diff tool (e.g. WinMerge) to find out what the differences are between your existing config file and the "clean-slate" new one.
You can copy the non-issue sections from the old one to the new one, like the connection strings and the application settings, forms authentication modes, etc. You might have something wrong with the compiler section or something a little more specific to the .NET framework.
Did you convert the project at all from targeting .NET 2.0 to .NET 3.5? There's a big web.config section that gets added to 3.5 projects that wasn't required for 2.0 projects regarding the compiler, as it uses a separate compiler for .aspx inline-code than was used for 2.0.
iis 7.5 (on windows 7) is a pretty different animal than iis 6 (on windows xp). there are some configuration incompatibilities. one thing that comes to mind is a little different schema for the attributes on the elements for http handlers and modules. there are other things that are different. usually on the error page, it will tell you what it doesn't like. i imagine it was there and maybe you didn't notice it. or maybe you were hitting the page remotely and it didn't have all the detail. i suggest using a browser on the local machine and take a closer look - pretty sure it will tell you what is making it puke.
I ran into this ambiguous error for the first time today in VS2019. I had added a new Entity Model (.edmx) which required adding a new connection string to a separate project's web.config. After adding it, I immediately started getting the error on startup. I noticed there were several config transforms for the various environments. After adding the missing transformed connection strings to each of them that error has gone away.
I always thought that when you dropped a control onto an .aspx page that a declaration of that control ended up being generated for you (either in a designer file, or within your code behind). All of the apps I have worked on have worked this way.
A coworker of mine was installing resharper and it was showing that all her code behind pages would not build. Turned out that resharper could not find a definition for any control that she has dropped onto her markup. She has no designer files, and no declarations in markup. Do they get automatically built when putting together the partial classes? Is there an option at that page/project level to instruct .NET to do this for you? Is this a difference between web app and web site?
This is a a .NET 3.5 site, C#, and it is running in a production environment.
Thanks in advance
You are correct in the difference is that she's running a Web Site project as opposed to a Web Application project. In a website there are no designer files. So to answer each of your questions...
Do they get automatically built when putting together the partial classes?
Yes, when the .aspx gets compiled the controls are created as if they were there...this happens in the background in VS so you get intellisense.
Is there an option at that page/project level to instruct .NET to do this for you?
Kinda, use a Web Application project for this :)
Is this a difference between web app and web site?
Yes, one of the main differences :) Web Application projects have a Page.aspx.designer.cs that house the control declarations.