how save file on server using HostingEnvironment.MapPath() - asp.net-mvc-2

in this code iam trying to save text document on server / wwwroot folder. nothing happens :(!
if i am working on localhost and doing the same routine like this, everything works fine and i can save text document on local pc.:

If the same code works in your Dev machine and not working in Production, It should be folder Permission issue. I guess you have to change the folder permissions in server so that ASP.NET can write to that directory.
Checkout this link which explains how to do that.
Make sure you are not giving Write/Modify Permission to "Everyone"

Related

Powershell copy vs move cmd

I'm running into some issues with my existing powershell script that copies data from a remote location into a local folder - that local folder also happens to be sync'd with google drive for desktop.
I'm seeing incomplete files being uploaded etc. In order to combat this I think it would be easier/better to change where the initial remote > local is putting its files, and instead of copying directly into the sync folder - copy into a temp/staging location that's NOT the sync folder.
Once that process is complete then use the powershell move-cmd to simply 'move' which will just update file locators to be that of the sync folder.
I think this will solve my issue.
Anyone see any problems with this approach?
If you have ruled out device connectivity, multiple files being uploaded at once vs. a single file being uploaded, and mobile device app or internet browser there is nothing wrong with your approach. If you need anymore assistance please reply to this thread or mark this as the answer.

link database to php script to c# on a server

I need some help! i just cant figure it out. i have made a game (WebGL) added a database script using unity UnityWebRequest www = UnityWebRequest.Post and i have a PHP file. i uploaded the game build and the PHP file to a server. in the root directory of the domain, i want to use. i have my index.html (game) its folders and a SQL connect folder with the PHP script inside. I have made a database in PHPMyAdmin and put the connections in the PHP script. well, i can't get it to work. i really need some help!! please! on localhost it works fine but i cant get it to work online
so it turns out it was the CORS header that was missing once i added that everything showed

Fail to access Modx Manager from a different computer. Says password and username are incorrect

I am new to Modx. I successfully installed and set up Modx on my laptop on localhost using xampp. However I would like to work on Modx on my desktop. I have copied over the htdocs onto my desktop. And have set up my database identically. When accessing Modx Manager, my username and password is said to be incorrect. I am using the same username and password and it works on my laptop (I have checked for typos). I do not understand why I am unable to log in. Can someone guide me so I can successfully work on my Modx on my desktop computer?
Often a stale session from your browser can prevent login. Try logging in from an incognito window.
Also, did you ensure that the MODX install on your desktop has the correct paths in config.core.php files? There's one in your document root, one in your manager folder, and one in your connectors folder.
Furthermore the paths and DB connection info need to be environment specific, in {core_path}/config/{config_key}.inc.php
When you migrated the site to your desktop, did you run the setup program again? Often that helps to fix paths, but you need to normalize the config.inc.php file first.
If you can access the database directly, you can change the hash_class value for your user in the modx_users table to hashing.modMD5 temporarily so that you can manually enter an MD5-hashed password. Maybe there's an issue with the PBKDF2 on your desktop local environment.
Some ideas to try, anyways.

How to deploy my project to localhost?

I'm working on a website and right now I am using FileZilla to make changes to it. Every time I make a change, I have to re-upload the file to the website through FTP and then wait for it to update online. I want to just deploy my project to localhost so I can get instant results and then just upload the whole project when it's finished. How do I do this? All I have is a set of directories with the files in them.
You really need to use a web/application server such as IIS/Apache.
For PHP projects go for WampServer/XAMPP.Easy to setup and works very well.
(maybe too obvious)
If you are working only static content based on html/css/js you can just edit and view changes directly by opening the local file in your browser and refresh each time.
Furthermore for css and html you can edit your code "live", directly into browser and see changes immidiately.
Another option is to edit files with an editor that supports ftp like notepad++, you can connect via ftp, open and edit files directly from server (like php,html,css,js) because once you save the editor will automatically upload your changes.
Heres a good explanation about notepad++ and ftp plugin.
Localserver
If you work with php (and even only with html/css) the best choise is to run a local server that rappresents a real environment in which your code will run. As said by others XAMPP is a good choise for begginers because of simple installation and management.
XAMPP download
XAMPP tutorial
Once installed put your folder inside C:/xampp/htdocs/yourCodeFolder
Run the xampp control panel and start the Apache server.
Finally navigate with your browser to: http://localhost/yourCodeFolder/

Deleting files on remote server

I have a PHP project in NetBeans with remote files (over sftp). When I create, modify anything these changes happening both locally and on my web server. However when I'm trying to delete a file or a folder it gets erased only locally. What could be the problem?
Permissions seems to be ok, all files belong to the user I'm using to access the server.
I'm using Netbeans 6.9.1, default configuration, all updates installed.
Netbeans does not have a synchronization function. It is limited to downloading and uploading files. What you can do is to use some external tool, for example WinSCP is capable of synchronizing local and remote directories.
I read what you wrote... but I think it could be a permissions problem.
I also use NetBeans and when I delete a file from the project window it first erase it locally and then syncs with my server.
I login through sftp (using vsftp) as root, which is a bad thing, but you could try this too to be sure if it's a permission issue.
You mistakenly turned off the settings. Please follow these steps:
Right click on the project name
Select properties
From the list of the left select 'Run configuration'
On the left almost down, look for the setting 'Upload files:'
Make sure you set that to 'On Save'
All the best man