Web Resource was not found - asp.net

I've spent the last day trying to get a checkbox validator to work. I found some starting code on the 4GuysFromRolla website, however this was coded back in 2006 and doesn't play alongside updatepanels.
I've made changes and now it works. As I'd made quite a few changes I wanted to standardise it and use it alongside other utility classes, so I created a new class project and copied the code verbatim.
The problem is that the original works, but I get a WebResource not found error on my new class project.
The differences are: The original was a web application project:
my new project is simply a class library project.
The original assembly and namespace have changed.
Both contain a single class and a resource file (.js)
Both resource files are contained in the root directory
Both resource files are set to embed resource
I'm running out of ideas, and have exhausted the answers I've found on the web with no success.
Is there an issue with the fact that its a class library? Have I perhaps overlooked something else?
Its pretty difficult to see beyond those 2 questions because the project is so small and insignificant.
Here's the code that does work:
if (this.RenderUplevel && this.Page != null)
{
ScriptManager.RegisterClientScriptResource(Page, this.GetType(), "skmValidators.skmValidators.js");
}
Here's the code that doesn't:
if (this.RenderUplevel && Page != null)
{
ScriptManager.RegisterClientScriptResource(Page, this.GetType(), "ValidationExtender.EvaluationFunctions.js");
}
Anyone give any ideas?
Thanks in advance.

The error turned out to be a mismatch between the dll's in the test page.

Related

Is there a way to see the RenderTreeBuilder version of the razor file in blazor?

Take the index page for example:
<h1>Hello, world!</h1>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" />
It is my understanding that this will be translated into some code using the RenderTreeBuilder which may look something like this:
builder.OpenElement(0, "h1")
builder.AddContent(1, "Hello, world!")
.
.
.
Is there a place where I can inspect the RenderTreeBuilder version of the razor pages?
I would like to start trying out RenderTreeBuilder and would like to know how it is done, for references purposes.
Apologies in advanced if this is a duplicate. I will delete this question if so.
Thanks!
You are right. The BlazorMarkup is translated into C# files that are using the RenderTreeBuilder. It is comparable to what WPF does when it comes to XAML and C# files.
After you have built your project, go to the obj/debug/net5.0/Razor/.
Keep in mind to use a debug build. Otherwise, you won't see the files.
You will see the same directory structure as in your project. Directories are listed as long as they contain razor files. Open the file, e.g., Index.razor.g.cs (.g stands for generated), and you can see the calls to RenderTreeBuilder
[Microsoft.AspNetCore.Components.RouteAttribute("/")]
public partial class Index : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.AddMarkupContent(0, "<h1>Hello, world!</h1>\r\n\r\nWelcome to your new app.\r\n\r\n");
__builder.OpenComponent<BlazorApp1.Shared.SurveyPrompt>(1);
__builder.AddAttribute(2, "Title", "How is Blazor working for you?");
__builder.CloseComponent();
}
#pragma warning restore 1998
}

Cefsharp : problem with the Reqest Context of the General Usage page

I have some problems, to change user profile with cefsharp 71.0.2.
All is working good with an user1.
To change users, the General Usage Wiki page gives me the solution.
But the 3rd line of this code
var requestContextSettings = new RequestContextSettings { CachePath = cachePath2 };
browser = new ChromiumWebBrowser();
browser.RequestContext = new RequestContext(requestContextSettings, new CustomRequestContextHandler());
gives 2 errors :
impossible to convert Cefsharp.RequestContextSettings to Cefsharp.IRequestContext
CustomRequestContextHandler reference can't be found.
I used Nuget to include the package 71.0.2 targetFramework 461 to my project.
A RequestContext(requestContextSettings) constructor is working to run something, but the browser is frozen on the last page I loaded with the user1.
Some tips to fix the problem ?
I saw that a 73.1.120.pre is on GitHub, but I don't know how to manage that without some Nuget package.
Tx for your help.

Why creating model in any other location than client, meteor runtime throws exception?

I am a meteor newbie. I am trying out by building a simple app and it does nothing but shows list of items. I first tried out with hard coded model values in my client javascript code and it worked just fine. I then created a folder called 'model' under root of the application and created the model there like the following
Favorites = new Meteor.collection("favorites")
with this change, meteor throws exception pointing to this line of the file on load. If I move this code to client the code works ofcourse that is wrong. The full code is # https://github.com/ksunair/13favs It is a very simple solution has few files and less than 20 or 30 lines altogether. My client code is,
Template.favorites_main.helper({
favorites:Favorites
});
I did the following in order to clear your app of errors:
Favorites = new Meteor.Collection("favorites"); (Collection starts with a capital C)
I moved model/mainmodel.js to lib/mainmodel.js so Favorites would be available as soon as the template rendered. I always put my models under lib (or in a subdirectory) so they will be loaded first. This contradicts what I see in other places including discover meteor, so I'm unclear what the best practice is. In any case, it fixed the problem.
$ meteor add accounts-ui was needed because you referenced Accounts.ui.config.
You need to actually do a find in your favorites_main template. So it should look something like:
Template.favorites_main.helpers({
favorites: Favorites.find();
});

'The class exists in both dlls' .NET issue

I cannot deploy my asp.net 4.5 website because I am getting multiple dreaded "The type 'myClassX' exists in both C:\Users\Me\...\whereItsSupposedToBe\ and C:\Users\Me\AppData\Local\Temp\Temporary ASP.NET Files\root\1randomname\_shadow\2randomname\3randomname\App_web_myClassX.cs.4acf3bb.nommceoi.dll errors.
There are three files involved. MyClasses.cs contains definitions for MyClassB, MyClassC, MyClassD. Page1.aspx and page2.aspx include in their <%page %> tag a src attribute for MyClasses.cs.
I have so far done the following:
cleaned the solution and project
shut down VS12
deleted the root\1randomname directory and emptied the recycling bin
restarted the #^$#ing computer
deleted the offending files, cleaned and built, created new files and
renamed all involved filenames, classes and namespaces (oh yeah, they
all used to be'myOGClassA'....)
introduced dummy variables hoping that would change the dll
deleted the bin and obj directories
added the batch="false" attribute to the compilation element of the
web.config file as mentioned here: ASP.Net error: "The type 'foo' exists in both "temp1.dll" and "temp2.dll"
Something makes me wonder if having two of the aspx files having references to the same src file has something to do with it. But in all the blogs and SO posts Iv seen so far that would result in the conflicts both coming from the temp directories.
Head starting to hurt... Any suggestions?
I have "fixed the problem" but I am not sure why it is fixed.
To recreate the problem:
Create a New Project -> ASP.NET Web Forms Application.
Create a new folder ("Search").
Add the three files from the demo project zip found at Static-Site Search Engine with ASP.NET/C# by craigd (Searcharoo version 1). These files are Searcharoo.cs, SearcharooCrawler.aspx, and Searcharoo.aspx.
Take a look at SearcharooCrawler.aspx. At this point I get the 'exists...' errors. If you still do not see errors, view the project in the browser. The errors seem to appear as you are looking at the .aspx files in VS12.
To fix:
Create a new folder ("Happy_App")
Move Searcharoo.cs to the new Happy_App. This fixes the 'exists...' errors, but now Searcharoo.cs 'can't be found' so...
Delete the 'Src="Searcharoo.cs"' attribute from the top <%paging...%> tag in both aspx files. I believe that this Src attribute is no longer used in ASP.NET 4.5 (I may be wrong)
View in browser and navigate to the Search/SearcharooCrawler page. No errors! (need to add a few properties in web.config to get the searcharoo demo working, but thats not the point of this post...)
But the truly weird part - I found that after moving the Searcharoo.cs file to the Happy_App folder I could move it back the original Search folder without any 'Exists' problems!
Why??
If anyone has an explanation that would be awesome. But for now I'm happy I could get a resolution without sacrificing a small animal...

Preventing Flex application caching in browser (multiple modules)

I have a Flex application with multiple modules.
When I redeploy the application I was finding that modules (which are deployed as separate swf files) were being cached in the browser and the new versions weren't being loaded.
So i tried the age old trick of adding ?version=xxx to all the modules when they are loaded. The value xxx is a global parameter which is actually stored in the host html page:
var moduleSection:ModuleLoaderSection;
moduleSection = new ModuleLoaderSection();
moduleSection.visible = false;
moduleSection.moduleName = moduleName + "?version=" + MySite.masterVersion;
In addition I needed to add ?version=xxx to the main .swf that was being loaded. Since this is done by HTML I had to do this by modifying my AC_OETags.js file as below :
function AC_FL_RunContent(){
var ret =
AC_GetArgs
( arguments, ".swf?mv=" + getMasterVersion(), "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, "application/x-shockwave-flash"
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
This is all fine and works great. I just have a hard time believing that Adobe doesn't already have a way to handle this. Given that Flex is being targeted to design modular applications for business I find it especially surprising.
What do other people do? I need to make sure my application reloads correctly even if someone has once per session selected for their 'browser cache checking policy'.
I had a similar problem, and ended up putting the SWF files in a sub-directory named as the build number. This meant that the URL to the SWF files pointed to a different location each time.
Ideally this should be catered for by the platform, but no joy there. But this works perfectly for us, and integrates very easily into our automated builds with Hudson - no complaints so far.
Flex says:
http://www.adobe.com/livedocs/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001388.html
What I have done is checksum the SWF file and then add that to its url. Stays the same until the file is rebuilt/redeployed. Handled automagically by a few lines of server-side PHP script
here is sample.
function AC_FL_RunContent(){
var ret = AC_GetArgs(arguments, ".swf?ts=" + getTS(), "movie",
"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
"application/x-shockwave-flash");
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function getTS() {
var ts = new Date().getTime();
return ts;
}
AC_OETags.js is file and it exists html-template several places.
but as my posting said, I am facing another type of problem.
The caching is not done by Flash Player but by the browser, so it's out of Adobe's control. I think you have found a workable solution. If I want to avoid caching I usually append a random number on the URL.

Resources