I currently new in ReactJS, And I work this project using laravel and this reactjs. I have question regarding why when i open my web application intead the application is shown why the list of folder shown to my browser?
Scenario: It happen when i upload the whole project to the server it shows look like this.
Do i need to configure in my files so that when i browse my application it will automatically redirect to the application.
You must visit the public directory of your project or if you use virtual host, set the public directory as the entrance.
Related
I'm working for educational purpose on create a react app and serve it in a subdirectory of an existing domain which already hosts a web application.
Just to try to be more clear I have this situation:
www.mydomain.com (this is a web application currently online)
Now I need to put this new web app under
www.mydomain.com/test
To try to make it work I have my wwwroot folder with my brand new subfolder wwwroot/test.
Now the problem is that if I just put (in wwwroot/test) a simple html file with nothing more than just an <h1> tag, I can open the URL and see the content in it.
If I put my react-app (which work fine in my develop environment) I just see an empty page and if I open the inspector I see that some of the necessary resources aren't reachable because their requests point to root domain (www.mydomain.com/css/ionicons.min.css instead of www.mydomain.com/test/css/ionicons.min.css).
This is my very first time with IIS and I'm trying to get it work by myself, but it seems that I'm unable to find a proper solution to my problem...
Hopefully I was clear enough!
thanks in advance to all who will spent some time reading about this!
I've already made some research and all of them seems to point to some kind of redirect/rewrite rule to write in the web.config of my subdirectory app and/or in the web.config of the root app.
I've also tried to put "homepage": ".", in the package.json which solved the problem of the resources not getting loaded from the proper path but the page is still blank.
I have an array of video paths that I want to play in REACT.
The issue is that the videos are outside of the public dir.
Any ideas on how to make this work?
If your link is a web URL, then you can use tag with href attribute to link your video on the web.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
Ok, so I guess the problem boils down to the following statement -
"You want to serve a few videos saved in a particular directory of your server so that your react application can play them".
Well, in that case, it is somehow like you want to make these videos publically available, so why don't you just move them to a public dir, or make the directory they are in a public one, you can use any web server like nginx to do that. see the following link Use nginx to serve static files from subdirectories of a given directory.
Please note that this solution will make your videos public. If you want only authenticated users to access your video, you should consider making a video streaming api on your server see this link for how to do this in nodejs https://dev.to/abdisalan_js/how-to-code-a-video-streaming-server-using-nodejs-2o0
I'm working on an ASP.NET MVC application with an AngularJS front-end and it's working great when running from visual studio/iis express, but not so great when I try to publish it so it's accessible to other users (e.g. navigating to http://server/application in a browser). I have IIS configured on server so that http://server/application points to an "application" folder that is structured as:
application
app
areas
foundation
main
layout
layout.html
bin
Content
fonts
Scripts
Templates
Views
Shared
_Layout.cshtml
Index.cshtml
Logs
Global.asax
web.config
The initial page, Index.cshtml (under Views/Shared/), gets loaded but includes this:
<div ng-include="'app/main/layout/layout.html'"></div>
which returns a 500.24 - Internal Server Error.
If I change the ng-include to:
<div ng-include="'application/app/main/layout/layout.html'"></div>
then the published application works but running it from visual studio/iis express returns a 404.0 - Not Found response when trying to load that layout.html file, I'm assuming because there's no parent "application" folder when it's running using iisexpress.
I did manage to get the published application working at one point by copying the contents of the published application folder to server's C:\inetpub\wwwroot folder but that doesn't seem like a proper solution, so what's the best way to inform Angular to look in the correct location for this ng-include?
What I ended up doing is adding an application path variable in my web.config file and prefixing all my ng-include or other urls with the application path, so they looked like
<div ng-include="'application/app/main/layout/layout.html'"></div>
and then updating my project Web properties to the following:
so that whether I publish it or run it through Visual Studio, it's running under the 'application' folder and looking for the html files in the appropriate location.
I am developing a Silverlight 4 application which displays items in a carousel control. The items are parsed form an XML file and then loaded as an image which can be double clicked to open a website, file, image etc.
I am already running in higher privileges mode (out of browser) to access the Xml file which sits in a subfolder of the application.
I can load the images fine when they are added to the project as they are included as resources. However, I need to be able to load images which aren't individually added to the project. Instead, I would like to add all images in a particular folder as resources.
Is this possible?
Thanks in advance
From Advanced Silverlight Out of Browser- Introduction
When running in a trusted environment,
you can access only files in user
folders, specifically the MyDocuments,
MyMusic, MyPictures, and MyVideos
folders
So, if you want to access folders other than this, you would probably need to run some sort of service, which has the proper rights. What kind of service depends on where this app is running. Could be a WCF service, or a simple WebService, if you can run a webserver on the machine. Otherwise, you'd need a windows service of some sort.
I added a Silverlight application to my ASP.NET website. Visual Studio made a new silverlight project and added its xap to the ClientBin folder under the project of my website. So both the projects are under one solution.
My Silverlight app is supposed to read an xml file and I was unable to make it access the file from the client bin folder under the website project. Adding a reference to that project does not work since it says only references to other silverlight applications can be added. Right now its working when the file is under the silverlight project but not when it is under the website project.
how can I make it read the file from website project?
The project structure is
WEBSITE1 (solution)
-WEBSITE1 (project)
-ClientBin
-file0.xml
-silverlightchart.xap
-SilverlightChart
-file1.xml
I can access file1.xml using
XDocument document = XDocument.Load("file1.xml");
I want to access file0.xml but no path works for me, for e.g,
XDocument document = XDocument.Load("~/ClientBin/file0.xml");
and WEBSITE1 is the startup project
You should be able to read a file from the ClientBin folder simply enough without needing to do anything special. At a guess I would say the you have accidentally set the Silverlight application as the startup project. In this scenario you want the website to be the startup project then either have the Silverlight apps test page marked as the start page or to navigate to the silverlight page once the browser has started.
Edit
The problem you have is that the Load method is synchronous but Silverlight does not support synchronous access to web resources. Hence passing a Uri to the Load method will only work if the that Uri can be fulfilled by content in the Xap. Thats why an Xml file in the silverlight project works because it ends up in the Xap.
To fetch Xml from the site you need to do this:-
WebClient client = new WebClient();
client.DownloadStringCompleted += (s, args) =>
{
XDocument document = XDocument.Load(args.result);
SomeFunctionToContinueWithDocumentProcess(document);
}
client.DownloadStringAsync(new Uri("file0.xml", UriKind.Relative);
// code exits here but _document won't be loaded yet