Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

EPiServer.Forms.Samples Resources Returning 404

Tim
Tim
Vote:
 

Hello,

I'm trying to install the EPiServer.Forms.Samples package in order to use Google reCAPTCHA. However when I add the form element to a form and try to load the page, several of the resources needed to render the reCAPTCHA element return a 404:

http://localhost/util/EPiServer.Forms.Samples/ClientResources/ViewMode/jquery-ui.min.css net::ERR_ABORTED 404 (Not Found)
http://localhost/util/EPiServer.Forms.Samples/ClientResources/ViewMode/EPiServerFormsSamples.js net::ERR_ABORTED 404 (Not Found)
http://localhost/util/EPiServer.Forms.Samples/ClientResources/ViewMode/RecaptchaElementBlock.js net::ERR_ABORTED 404 (Not Found)
http://localhost/util/EPiServer.Forms.Samples/ClientResources/ViewMode/EPiServerFormsSamples.css net::ERR_ABORTED 404 (Not Found)
http://localhost/util/EPiServer.Forms.Samples/ClientResources/ViewMode/jquery-ui.modified.js net::ERR_ABORTED 404 (Not Found)
http://localhost/util/EPiServer.Forms.Samples/ClientResources/ViewMode/jquery-ui.structure.min.css net::ERR_ABORTED 404 (Not Found)
http://localhost/util/EPiServer.Forms.Samples/ClientResources/ViewMode/jquery-ui.theme.min.css net::ERR_ABORTED 404 (Not Found)

I found a similar thread (https://world.episerver.com/forum/developer-forum/episerver-forms/thread-container/2018/4/episerver-forms-samples-clientresources-returning-404/#190210), but this guys solution doesn't seem to work for me.

Any help or direction would be greatly appreciated.

#205417
Edited, Jul 09, 2019 21:52
Vote:
 

Hi,

Are you running your site on a virtual directory. Note that Forms does not support that case. Could you please create site and run with VS to see if the issue still there?

#205423
Jul 10, 2019 4:59
Tim
Vote:
 

I don't believe so. It's a DXC site, and I couldn't find anything in Azure that indicated a virtual directory.

I ran a clean local site, and the Forms.Samples resources seemed to work ok.

In digging around, I did find that we've changed both our admin path, and util path in Web.config in order to obfuscate them both for security purposes. Could the changed util path have something to do with it?

The property in Web.config currently reads similar to this for the util directory:

<location path="newutil">
    <system.web>
      <pages enableEventValidation="true">
        <controls>
          <add tagPrefix="EPiServerUI" namespace="EPiServer.UI.WebControls" assembly="EPiServer.UI" />
          <add tagPrefix="EPiServerScript" namespace="EPiServer.ClientScript.WebControls" assembly="EPiServer.Cms.AspNet" />
        </controls>
      </pages>
      <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    </system.web>
    <system.webServer>
      <handlers>
        <clear />
        <add name="AssemblyResourceLoader-Integrated-4.0" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="PageHandlerFactory-Integrated-4.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="WebServiceHandlerFactory-Integrated-4.0" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer.Framework.AspNet" />
      </handlers>
    </system.webServer>
  </location>
#205571
Jul 17, 2019 1:24
Vote:
 

Yes, that is problem, changing the util path in web.config. The the Forms Sample code, there is a line to give anonymous access to the js files.

publicVpp.Add("virtualPath", "~" + ModuleHelper.GetPublicVirtualPath(Constants.ModuleName) + "/ClientResources/ViewMode");

the ModuleHelper.GetPublicVirtualPath(Constants.ModuleName) always return path in util folder. Please change the code to return path with newutil and build package yourself. The problem might be solved.

https://github.com/episerver/EPiServer.Forms.Samples

#205574
Jul 17, 2019 3:58
Vote:
 

Hello guys,

I have the same exact problem except the thing that i didn't changed anything in config file. I'm still getting 404 even after a fresh reinstall. Any idea what can interfere with this?

#209549
Nov 18, 2019 7:57
Vote:
 

I'm also with the same problem. Alex Corbeanu have you found a solution for this?

#210575
Nov 28, 2019 11:59
Vote:
 

My solution was to remove the package... i wasn't able to fix it so far.

#210586
Nov 28, 2019 15:46
Vote:
 

Alex Corbeanu, I've found a way. It's not pretty, but did the job.

1_ get the Forms Samples project from git hub, clone it to your environment.

2_ Find the places where its code refers to the /util/ paths (ViewModeExternalResources.cs, AddressesElementBlock.cs, DateTimeElementBlock.cs, DateTimeRangeElementBlock.cs, RecaptchaElementBlock.cs), and change it to refer to a valid and accessable path on your solution.

Like, for me I've changed from this:

new Tuple<string, string>("script", publicVirtualPath + "/ClientResources/ViewMode/datetimepicker.modified.js")

to this:

new Tuple<string, string>("script", publicVirtualPath + "Content/ViewMode/datetimepicker.modified.js"),

Where publicVirtualPath is just the my sites url.

3_ Copy the files inside ViewMode folder to the folder you specified on the changes above(on your project). Me for example, copied the files inside de ~/Content/ViewMode/ directory.

4_ Build the project again.

5_ On your solution, the project you're working on, you install the samples package normally.

6_ On the references of your project, delete the reference to the samples package.

7_ Find the main dll generated by your build of the samples project, it will be inside the bin folder. "EPiServer.Forms.Samples.dll". Copy it to your project putting it inside a libs/ folder, inside the root of your project.

8_ Add a reference to this dll. This will trick the solution to use your modified dll instead of the original one.

#210601
Nov 29, 2019 12:07
Vote:
 

Thank you Fernando. I needed this package only for the visitors group functionality. I was just working on implementing that in my solution better than adding the whole package. I checked your steps and I'm thinking it is a great solution. Thanks!

#210602
Nov 29, 2019 12:10
Tim
Vote:
 

Apologies for the extended radio silence. Other things took priority and so this took a long time to resolve.

Apparently I wasn't too far from a solution in my comment above.

According to a talented developer friend of mine, I simply needed to add another "location" property for the EPiServer.Forms.Samples "util" directory in web.config, like this:

<location path="util">
    <system.web>
      <pages enableEventValidation="true">
        <controls>
          <add tagPrefix="EPiServerUI" namespace="EPiServer.UI.WebControls" assembly="EPiServer.UI" />
          <add tagPrefix="EPiServerScript" namespace="EPiServer.ClientScript.WebControls" assembly="EPiServer.Cms.AspNet" />
        </controls>
      </pages>
      <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    </system.web>
    <system.webServer>
      <handlers>
        <clear />
        <add name="AssemblyResourceLoader-Integrated-4.0" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="PageHandlerFactory-Integrated-4.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="WebServiceHandlerFactory-Integrated-4.0" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer.Framework.AspNet" />
      </handlers>
    </system.webServer>
  </location>

Hope that helps someone in the future!

-Tim.

#216320
Feb 03, 2020 23:16
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.