How to avoid ASP.NET website being hacked? [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
AFAIK attackers can overwrite files which have CHMOD values 777 on linux servers. Today my web site which created by myself using ASP.NET has been hacked. My Site.master page has been appended with lots of backlinks and there was a folder named as Sayers which has many html files (probably include search keys).
I could easily delete the folder and restore the original Site.master file.
I do not have SQL injection problem. Even if so I would have seen some additions or changes in the records. There is nothing. There are only changed files and added folder.
I have updated my FTP password. I am 100% sure that I do not use a third party extension. All the code is handmade (: So I want to know how to prevent this to be done again. Also what could be the vulnerability about the website. I also want to know if it is a server side problem or my problem.
I am using a hosting company's service. I use FTP (21), not secure.

Related

Is there any way to Read & Update appSettings.json file from any controller method to save usersettings in ASP.NET Core 2 MVC [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I tried many tricks from StackOverflow to Save & Update appSettings.json file but nothing working. Some snippets working only in Startup.cs only for read appSettings.json not for updating. Please help!
First of all, it's a bad idea to persist user settings into appsettings.json. The OS process executing your MVC app should never have write permission to this file for security reasons.
I would probably use a DB engine with ACID capabilities for this purpose. However, it could be ok to store such user settings in the file system - but in a separate file, at a safe location.
For example I'd create a folder named say App_Data in the application root folder, set write permission to it and place an adminsettings.json file into it. Then I'd use this file as my persistent storage for the said user settings.
Obviously, it would require some coding to make all this work. I put together a code sample for you which aims to reuse the configuration and options API of .NET Core. I think it exceeds the size acceptable here, so I made it available as a Gist.

How can I copy files from filepath mentioned in cells in excel in my server using c#? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am trying to build a bulk upload functionality on an ASP .NET page. this is required to upload questions and answers in a SQL table. There can be images as well in the question and the answers. For those images, the path to image can be specified.
Is it possible to copy the images from end user's machine to the server and then move these images into the SQL database?
"Is it possible to copy the images from end user's machine to the
server"
Not unless you provide a file input control explicitly on the page and the user puts the necessary file(s) into that control and they get uploaded along with your other data.
Your server does not have access to the user's machine. In fact it almost certainly doesn't even know exactly which machine the request came from. It certainly doesn't have access to any of its disk drives, unless the machine has its own specific public IP address and appallingly lax firewall and security settings.
In fact even your webpage, when it's rendered in the user's browser - which is on their machine - doesn't have access to the disk (think of the implications if a webpage could randomly read files from your disk!) except via a file upload control where the user has to specifically choose which files to send to the server.

Where to put files used by a .Net application [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Here is a question not about code but about patterns. I'm developing a .Net application that needs to use three files in order to work properly.
File 1: Has the app settings created by a configuration form
File 2: Binary file that contains a set of serialized objects used as a playbook that the application follows in order to realize sequential tasks.
File 3: A sqlite database used as a record cache that the application updates on every start
Now my question is about file location, where to put this files? On Program Files or AppData inside the users's Documents And Settings.
Thanks in advance.
AppData should always be preferred, since it requires less permissions (you might need Administrator permissions to create / updated files in Program Files).
Also it depends whether data should be personalized or global for all users. Take a look at this post

Is it possible to run an EXE from MVC site? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Is it possible to call an exe from a MVC site?
I've seen this link. (I'll try it tomorrow in the morning when I get in the office)
Stackoverflow link
However I wanted to know if I cam barking up the wrong tree.
I have a 3rd party app that provides us a stand alone exe. Instead of sending this exe to x amount of clients. I would like to keep that exe on my web server so I can control who can use the exe.
Is this is viable option?.
You might find the responses to this old question helpful. If you are trying to run an exe file within your application, I think this would be the approach to take.
If I have understood your question wrong, and you are trying to provide users with a link to download an application, or a link to launch an application that already exists on their computer, then you will probably want to look into the html <href> tag.

Sharing an application to another computer [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
When you send an application to someone, using another computer, besides the application itself, do I have to send the Resources File too? And if I am using a DataBase do I have to send the Database.mdf file too? And what else would you have to send to make sure your application works on another computers?
Sorry if this question is a repeated one, but most of the others just ask for a single item, either the Resources or something else. But I would like to know about everything you have to send.
Thanks a lot !
it depends on your approach. i think you have a software with database and... that you want to sell and make it owrk on other users device. you can make you app make a new database on first start. you can include database files if its local and add to user app directory and... it all depends on you packaging method and tool.
or maybe you want let someone continue the project. so you can give other developer a back up .bak format or export database files from sql server management studio and other developer can attach them to the other machine project

Categories