.NET 7 API project can't find images - asp.net-web-api

I began with a standard .NET 7 Web API project that runs fine. I ran into a situation where I need to return a one-off view and I didn't want to create another project to serve views so I added a normal controller to the project with a method to return said view. The view gets returned as expected but none of the resource links work, including images.
So this html:
<a href="index.html" class="logo">
<img src="images/popupshop.svg" alt="">
</a>
returns this view:
This is how I have added the image to the product:
Not sure what else I'm missing?

Adding:
app.UseStaticFiles();
to the Program.cs allowed the paths to work

Related

how to count a calling route from server in laravel

Is there any ways to count a special route from another folder in server when it is calling in Laravel project?
For more information, I have below link in my laravel project:
The application.apk in in Android folder in server.
<li>
<i class="fab fa-android" aria-hidden="true" style="font-size: 20px;"></i><span>get android app</span>
</li>
how can I count number clicks on this link?
I think you could add a special class that on click, it sums the click calling via Ajax a function inside a controller of laravel. Then it will sum that click wherever you want.

Ajax calls without AjaxHelper in aspnet core 2

I was trying to implement an asynchronous call with ajax in my aspnet core 2.0 project, using "Ajax.BeginForm", but then I discovered according to these threads on github and stackoverflow that there's no support to this class in aspnet core, nor MVC 6.
Is there any other way to use ajax assynchronous calls, in aspnet core, besides the old way, with $.ajax function? My problem with this, is that, with AjaxHelper class, I could do everything with razor, in the view file, and keeping everything organized in one place.
Why would i use the razor language to make a loop, and print a list, or whatever, if i have to to make the ajax call, in the js file (or in a < script > tag)? I could work with the data right there, with js, and keep everything there!
How are you guys solving this right now? Thanks for your help.
This baffled me a bit too. I was like where is my lovely #Ajax helper that saved me allot of time in JS hell.
As #sam linked they have changed the API to be more HTML 5 semantic - Not sure why but OK
<form asp-controller="Home" asp-action="SaveForm"
data-ajax-begin="onBegin" data-ajax-complete="onComplete"
data-ajax-failure="onFailed" data-ajax-success="onSuccess"
data-ajax="true" data-ajax-method="POST">
<input type="submit" value="Save" class="btn btn-primary" />
<div id="Results"></div>
</form>
You can also do the same on anchors and don't forgot the tag to enable it
<a data-ajax="true" data-ajax-begin="alert('Hello!')">TEST</a>
And then I suppose you could create TypeScript files per page similar to Angular or one TypeScript per site, or just put the script on the page, example
var onSuccess = function(context){
alert(context);
};

using ZURB Foundation with laravel

I am new to laravel so I am not sure how this can be achieved. I am using ZURB Foundation and trying to create a button in the page.
I use linkRoute always to redirect to a named route then redirect to a specific controller action. I have the below:
<body >
<h1 align="center">ShopCon.com</h1><br><br>
<a style="margin-left:50px;" href="{{ HTML::linkRoute('membersaccess', 'Members Access') }}" class="medium success button">Login or Register</a>
</body>
but when I render this, it shows like this
Members Access" class="medium success button">Login or Register
instead of showing the button and text within it and link to named route. How can this be fixed? I read something about macros but unable to clearly understand them or use them to achieve this.
Picture included for reference:
HTML::linkRoute produces an HTML anchor tag.
Since you only want the URL, use URL::route.

How can I display a Media picker image

Sorry this might be a newbie question but I am quite new to Umbraco.
I have a media picker set up on a document type, and it all works fine.
So I go to the template and enter
#Umbraco.Field("bottomRightLarge")
this only gives me the ID of the image, how can I get this to show the actual image the user has selected?
I am using UMBRACO 7 - and I have tried http://our.umbraco.org/projects/website-utilities/social-bookmarking-button/general-discussions/19360-Displaying-an-image-from-Media-Picker-in-a-web-page - but the XSLT ERRORS bug time.
Try using the umbraco image item if using webforms or umbraco media for mvc
<img src="#Umbraco.Media(model.articleImageOne).Url" alt="">
or
<umbraco:Image field="articleImageOne" runat="server" />
This worked for me
<umbraco:Macro runat="server" language="cshtml">
<img src="#Model.MediaById(Model.topleftsmall).umbracoFile" alt=""/>
</umbraco:Macro>
please note I was trying this on firefox 20.0.1, and the save just didnt work properly.

AJAX Wordpress Site with Difficult URL settings

On this WordPress theme utilizing AJAX, proves to be difficult. The developer of the theme cannot seem to find the issue or solution to it.
This site runs beautifully, if, and only IF, you type is this complete URL "http://www.geigerandwood.com/#!//" if you type in the .com site alone, it will appear but will be disfunctional.
I have made attempts in 301 redirects, even creating a static page with a redirect but still no luck. Is there something that I can add or change in the code to make this work properly?
FYI - it has been tested on the common web browsers on both OSX & Windows.
Here is a video of my presented issue. http://www.screenr.com/D1G8
What theme do you use?
My quick examination of your page source code is that I only can find something related to the #!// is in here
<div id="contentBoxScroll">
<a id="closeButton" href="#!//"></a>
<div class="dragcontainer">
<div id="contentBoxScrollDragger" class="dragger">
<div class="scroll_up"></div>
<div class="scroll_down"></div>
</div>
</div>
</div>
I assume it must be something inside the script from which that HTML is generated. I can say more since I can't see the full source.

Resources