Clear Temp ASP.NET files from Azure Web Site - asp.net

I have a issue with a ASP.NET nopCommerece Plugin that seems to be cached on the server.
I have cleared the nopCommerce cache and restated the application but it didn't help
One of the normal steps is to clear out \Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files but since this is a Azure Web Site, I only have access via FTP and I don't have access to that directory.
How do I go about clearing the Temp Files.

when you publish the website on to azure, by right clicking and choosing publish, there should be a option under setting saying: Remove additional files at destination. Check it and publish.

I managed to do this by creating a temporary file in the bin folder of my website.
This casuses the temporary hash file to change in the temp folder and then ASP.Net rebuilds everything.
See here for more details about the hash file and its relation to rebuilding.
Remove Additional files didn't fix my problem as it only removes files in webroot not the temporary asp.net files. As far as I can see with Azure you have no access directly to the temporary asp.net files

Related

folder explorer for server files

Is it possible to rename/move or delete files from a web application (ASP.Net MVC) that are on a server folder just like how you would do it locally? I would want the user to be able to upload say 30 files (from a scanner auto-feed) into a temporary folder on the server (cannot save it locally due to data security) and then allow the user to be able to rename /move before uploading them onto Azure blob storage.
I saw few examples - jquery file tree seemed good but not sure if it allows rename and moving. Please suggest solutions for working with the server folder. I intend to delete the server folder after I am done transferring files to Azure. TIA.
Yes, you can do this by giving the USER that is running the ASP.Net application (defaults to IUSR) permissions to write to that folder.
Be very careful though, as you're potentially opening your website for abuse when doing this.
See: https://www.iis.net/learn/get-started/planning-for-security/understanding-built-in-user-and-group-accounts-in-iis for how IIS users operate.

Asp.Net : Is it save to upload and files in web config folder?

Is it good practice to store user's files(images,documents etc) in web config folder ? Is it gonna affect my website anyhow ? Because i do know that it is unacceptable to store dynamic/user's files in the BIN folder. So now i'm trying to establish a folder path to store my dynamic files. The other reason is that my service provider said i'm only allowed to store files in the folder where i store my website because i'm hosting my website on a their shared server.
It's safer to store uploaded files either:
under the App_Data folder
or, outside the website's root folder.
This ensures users can't navigate to the uploaded files.
In your case, your service provider's restrictions mean you should store them under App_Data.
A 'web config folder' doesn't really exist. The web.config is a file that can exist at any level in your website directory structure.
To answer your question: simply create a folder anywhere under your website and store the files there. You can create different directories for each user if necessary. This should not adversely affect your website in any way. But... if you expect hundreds of thousands of files, you may need another solution.

Where does IIS look for files

Can anyone explain, please, exactly how .net works. I create a web site in Visual Studio and publish it to a local server to a folder at
D:\WebSites\Project1
I create a web site in IIS and provide the address of the folder containing the files for the web site. When I publish the site, using 'fixed naming and single page assemblies', all the .aspx files go in the folder on the D drive and a dll for each page goes in the bin folder inside that folder.
I would assume that when someone wants to view a page in their browser, IIS retrieves the file(s) required from the folder specified, they get processed and turned into html and sent to the browser.
Recently when someone clicked a button on a page that calls a web service - a file not found error was reported. Apparently
C:\Temp\bx5tn2js.dll
could not be found. The thing is - why did IIS decide to look in C:\Temp for a file?
And, in the error message was a load of references to xml serialization. What is being serialized?
This file looks like the compile files that asp.net generates on compile.
This folder can be setup on web.config on compilation session with the
tempDirectory="C:\Temp"
If you do not have set this option asp.net is use a default folder that is usually inside the asp.net directory, inside the windows folder. But if you have set this, and this folder did not have the correct permissions, then asp.net fails to compile the project, and you can get a message like that.

ASP.NET Protect files inside folder

I have a shared hosting account in which I upload my ASP.NET application. I let the user upload .doc files inside a folder, the problem is I only want logged users to be able to download those files, so I wrote a dispatcher, you give it the id and it reads the file and writes it to the browser, hiding the file location, nevertheless I want to protect the directory where all the files are, so you can only download files using the dispatcher, I tried marking it as a password protected directory, but now ASP.NET can't get access either.
You need to restrict the NTFS permissions on that folder to only allow the user your applicaiton is running as. This might be difficult in a shared host environment...
The ideal solution would be to move the folder outside of the site root but I guess as you are using shared hosting this may not be possible.
One other solution would be to move docs to the App_Data folder which is protected by .NET (see here What is the App_Data folder used for in Visual Studio?)

making changes to an asp.net site without reuploading the whole thing

I'm building a site and for the moment, when I want to put it on the web server, I to go Build > Publish WebSite to a local directory and then on the FTP, I delete the whole existing content and then upload the new fresh content that's on my local directory. In the Publish Web Site popup, I see that there's an option for "Allow this precompiled site to be updatable".
If I make changes to some files in my AppCode directory, how do I update the server WITHOUT essentially shutting it down?
Thanks.
Unless you're using a precompiled site or a web application, all "regular" websites are updateable -- App_Code as well as content.
Precompiled sites can be made to be updateable, but I believe only for web pages, not for code files.
If you have a busy site with lots of updates it's possible that updates can break things until they're complete. You can work around that by creating a file called app_offline.htm at the top level of your site. That will effectively take your site offline as long as it's there. The contents of the file are sent to users instead of your active content, such as *.aspx files. When the update is complete, then remove the file.
Try to take a look here: http://msdn.microsoft.com/en-us/sync/bb840038
All that you need is a Synchronization between VS and server.

Resources