Uploaded image can't be saved in to folder and the image can't be view in folder when running web under IIS - asp.net-mvc

I have project to upload image and view image on asp.net. everything work as i expected. i can upload image and saved to my folder then saved the folder to database, then from database i can show or view the image.
Unfortunately, after publishing to IIS and run the web UNDER IIS , image that i uploaded won't saved to folder and also the image that contains on my folder can't be viewed when running web under IIIS.
I tried to search in stackoverflow how to solve it and everyone said it's about permission i have tried option to set the security permission but nothing works
Folder settings:
Subfolder settings:

I suspect it could be perhaps a wrong path as your app is installed under the default web site... I often suggest to alwyAs start from the exact thing that happens to avoid guessing about issues.
Edit: the folder structure is really strange. It seems I have the default web site, created an application root under this web site but your main ScraBoy app volder is still under this folder ??? I believe I installed app one level below what you intended

Related

Media folder not showing images in Umbraco

I have migrated a umbraco site over. Hooked the databse up and everything is working fine but the images are not showing on the site and in the media folder.
I have set the permissions on the folder.
changed authentication on the folder to app pool.
tried changing virtualRoot to rootPath and rootUrl.
none of the above work. The files names are showing in the media window but no images (blank previews).
Funny thing is i can upload images now and there are showing so something to do with path.
hope someone can help. thanks
Perhaps you need to tell Umbraco that it's running in a virtual directory.
There is a setting in the umbracoSettings.config which you can read about here: https://our.umbraco.org/documentation/reference/config/umbracosettings/#notifications (search for ResolveUrlsFromTextString)
Set the following to true:
<ResolveUrlsFromTextString>true</ResolveUrlsFromTextString>

Unable to render image uploaded within Electron app, built with electron-forge

I have a file uploader for users to store images, which I'm saving content to a folder within the application data directory (app.getPath('userData')). This all works fine.
When I attempt to load the image using a basic image tag, with the src pointing to the correct location within the application data directory, it fails to render.
This only occurs after I've packaged the app using electron-forge (make & package). I've only attempted to make for OS-X (darwin x-64). I'm guessing it has something to do with asar, but I can't seem to get this working. I've attempted to use the file protocol for the image source too.
Any idea how to correctly do this?
I found the easiest way is to serve all content up from a server bound to localhost

Using Backload to upload image to project file but images do not appear until project is rebuilt

Using MVC 4 I downloaded Blackcity Backload from nuget, I am trying to save the uploaded images to a file that is within my project. Everything works great and it shows that the image uploaded, except for the fact that after you upload a new image, and refresh the page the image does not appear in the list of returned images even though it was saved. Also if you delete a file it comes off the list at first but again if you refresh the page it is back. If you rebuild the application then everything appears as it should and the images in the backload file list are all listed correctly and they match what is in the actual file.
I thought it may be a server cache issue but I did all i can to prevent the server from caching and still same problem.
I think it may have to do with the fact that Backloader is dynamically creating folders to put the images in and they are not included in the project even though they are in the file structure. So since they are not part of the project they are not being returned in the get request. Its not until you rebuild that they are recognized as part of the project.
Is there a way to dynamically include new files in the project without rebuilding?
Please help. This is killing me.
Ok this is solved. Had to remove filters.Add(new AuthorizeAttribute()) from my global filters and then add [Authorize] to each controller and it worked.

System.IO.IOException destroys session after RedirectToAction [duplicate]

I have a web app where the administrator can create news, pdf documents and other stuff in his cms panel.
The problem is when the admin delete a new or something else the app deletes all the files related to that new, I mean the images, pdfs and other documents. Tha main problem is those files are stored in folders under the "news" folder and when the app deletes them the session is lost.
How can I do to have a file system without losing the session?
I'd like that file system within the app folder...
Impossible for us to store those folders outside the app and we don't want to use StateServer because of the performanne....
Any other solution?
Thanks
Your session is lost becasue IIS recompiles. The easiest solution in my opinion is to store your files outside the wwwroot.
Discussed on SO: ASP.NET restarts when a folder is created, renamed or deleted
[Update]
Example:
Let's stay your app is in c:\inetpub\wwwoot\virtualdir1
You make a work directory:
c:\inetpub\inetwork
Give the proper rights (read/write/etc) to the Asp.net user of your app pool and it should all work like a charm.
More info on setting the rights: What are all the user accounts for IIS/ASP.NET and how do they differ?
Store the path to the workdirectory in your web.config (you no not want to hardcode it)
Having those files within the app folder is a poor desgin. The session is probably lost as you are causing IIS to recycle due to the file system changes. It is much safer to not have your web application able to write to its own folder, doing so is a security risk.
Separate your document folder and web site folder. And give right permission your document folder.

File upload to IIS virtual directory

I am developing asp.net mvc web application in VS2008.In my project,users will upload their files.So that,we created a one folder and made virtual directory in IIS for it.That is just simple folder to store the files.But that folder path is not same with our application path and it is a separate folder.
For eg : upload folder path is "http://localhost/uploadfolder" and our application path is "http://localhost/TestApplication
I use Server.MapPath("~/uploadfolder") to get that upload virtual directory path but it returns like "http://localhost/TestApplication/uploadfolder" and I got error message "Upload directory not found". I also tried like Server.MapPath("http://localhost/uploadfolder") but still can't to upload.
My question is how can I point to that path from my application? How can I upload the files? I haven't hosted yet my application in IIS and I run it from Visual Studio.Please guide me the right way.I really appreciate your answer.

Resources