Got an error about existence a reference type in both dll after convert asp.net web form to MVC - asp.net-mvc-4

Recently I change a big project from asp.net Web form to MVC 4. every thing is ok , I change some codes , and reconfigure my Web.Config file. but I got an error about existence a reference type in tow dlls
I use something like this in all over of aspx files in my project \
<td>
<%= Resources.Resouce.AResource %>
</td>
Now after change (From web form to MVC) I got more than 2000 errors that Resource does not exists in some pages.so I changed the Custome Tool Namespace of my resources to Resources , so the project build successfully . but now I get another error
CS0433: The type 'Resources.Resource' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\4fbef14f\4d273162\assembly\dl3\bd8e90ff\dc59fc0b_ffd2ce01\LHW1-WebSite.DLL' and 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\4fbef14f\4d273162\App_GlobalResources.isqs-re9.dll'
As the first solution I clean the solution , but the problem did not resolved
As the second solution , I set batch="false" attribute in compilation tag in web.config. But still the error did not resolved
Is there any one to help me out there ?!
thanks

Related

How to use WebGrid in ASP.NET Core 2.0

I am trying to use WebGrid in ASP.NET Core (installed package NonFactors.Grid.Mvc6 followed instructions from link
#(Html.Grid(Model).Build(columns =>
{
columns.Add(model => model.FName).Titled("FistName");
})
.Filterable()
.Sortable()
.Pageable()
)
But running the code, the page shows blank, chrome-dev-tool: shows error:
Failed to load resource: net::ERR_CONNECTION_RESET
suggestions, what can be done to fix it.
Thank you
The error may occur when browser failed to download any resource file , check that in Network tab in F12 develop tools . Another possibility is resource blocked by one ad blocking plugin , you can click here and here for more details .
Since the WebGrid resources(js,css files) are downloaded and add to your project , IMO WebGrid plugin won't cause the resource load error .
The problem is that data is not bind to WebGrid . According to document , after installing the Nuget , you should copy the JS/css files to wwwroot folder , and reference them in your _Layout.cshtml , initialize MVC.Grid instances after rendering grid html as document shown .Also confirming you have sending the correct model lists to view form controller .

Error after publishing .net web project

I am publishing a project in my local computer, I am getting an error because of the path of the files, in my project I am using relative path, but when i published the project I specified a Site/application so I put: localhost/myapp, but then, after the login the additional name myapp make it loses the path references, do you have any idea how to go through this?
I encountered the same problem with my web application this problem occurs because in your application you are hardcoding paths for ex :- /Home/Index or something which creates problems whenever you want to provide paths use helpers like #Url.Action(),#Html.Action(),#Url.Content() as shown below :-
#Url.Action("Index","Home",new{//specify route parameters here//})
If you are using areas in you application then specify it as :-
#Url.Action("Index","Home",new { area="myarea" })

Have error for converting to website from web app

Hi I convert the web app to web site. I follow this link to do it. However I have an error for a few pages which are .ascx and the Global.asax. The error is “Context is not a member of …”. I also exclude the .vbroj file.
I searched the web for fixing the above error and found that link http://forums.asp.net/t/1148374.aspx?Context+is+not+a+member+of+Page+name+
. Although I did what it said, but the error didn’t go away. Would someone tell me what I can solve the issue.
Summary what I did:
1. Delete the .desginer file
2. Changed Codebehind to CodeFile
3. Change the path of the code file with full path within the root directory.
For example:
Form CodeFile=" Footer.ascx.vb" Inherits="Testing.Footer"
To CodeFile="~/Templates/Footer.ascx.vb" Inherits="Testing.Footer"
I solved the problem by deleted the namespace of inherits and change the full path of CodeFile. Also change the full path of #Reference

ASP.NET Mvc Project EF Code First Enable Migrations Error

I am working PluralSight Video Tutorials on ASP.NET MVC. And i couldn't enable migrations on package console..
when i wrote enable-migrations, i am receiving this error;
More than one context type was found in the assembly 'eManager.Web'.
To enable migrations for eManager.Web.Infrastructure.DepartmentDb, use Enable-Migrations -ContextTypeName eManager.Web.Infrastructure.DepartmentDb.
To enable migrations for eManager.Web.Models.UsersContext, use Enable-Migrations -ContextTypeName eManager.Web.Models.UsersContext.
when i wrote Enable-Migrations -ContextTypeName eManager.Web.Infrastructure.DepartmentDb., i am receiving this error;
The context type 'eManager.Web.Infrastructure.DepartmentDb.' was not found in the assembly 'eManager.Web'.
Thanks for your help.
I strongly suspect that your issue is similar to the one in this question:
How to Enable Migration to update my database in MVC4?
Check the selected answer and see if that helps with your issue.
The solution for the mentioned error "The context type .... was not found" is to select the correct project that holds the context type before running the enable-migration command. You can choose the correct project from the "default project" drop down at the top of Nuget manager tool window.
The solution to this problem is simple, just remove the dot (.) at the end of this statement "Enable-Migrations -ContextTypeName eManager.Web.Infrastructure.DepartmentDb." and run the package manager console again, the migration should be enabled.

Activate Visual Web Part Package in Share Point 2010

I have created a new project of SharePoint 2010 --> Visual Web part,
seleted it as form solution. and it created the web part.
I just edited it with Hello World! for confirmation and deployed it using VS, and successfully added to page.
problem, arrises when i activated the same package after uploaded it from site actions--> site settings --> galleries --> Solutions
-- > upload new solution --> activate it.
error came:
This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution 'GUID' failed validation, file manifest.xml, line 14, character 4: The element 'Solution' in namespace 'http://schemas.microsoft.com/sharepoint/' has invalid child element 'TemplateFiles' in namespace 'http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: 'FeatureManifests, ActivationDependencies' in namespace 'http://schemas.microsoft.com/sharepoint/'
I don't know why VS didn't get this error while its deployment or i am missing some thing while my deployment.
any idea?
Try to make your visual web part as sand boxed solution your problem will be resolved