Set extension for Challenge file using getssl - asp.net-mvc

I am using getssl to create a SSL from lets-encrypt. I think I have everything setup correct but am running into an issue with the Challenge file. The server I am using MVC on Windows on Liquid Web is not letting me use a file without an extension. If I add .txt to the challenge file it works correctly, so I know the file is accessable.
So I see two choices: First is to have getssl add a file extension to the Challenge file. Second is to allow files without extensions under MVC/Windows.
I have tried changing the web.config file and also looking for changes to the setting but neither have been fruitful.
http://my.site.com/.well-known/acme-challenge/WLasfaweaefqwwqetfgewfweqrtfwefwefsefasdfasdf_W1nuoZqCWbHTU

Found the answer here finally:
Letsencrypt acme-challenge on wordpress or asp.net mvc
Add the config file in the directory you want to download the file from.

Related

Grails 3 web interface with zip upload via form to a folder on the server

I'm trying to create a Grails 3 web interface with an upload form that writes zip files to a folder on the server.
I have already tried a lot of plugins or solutions that can be found here but nothing seems to work.
My code can be found on github (https://github.com/rm93/BIGC).
Would anyone know a solution that I could apply?
I have found a solution to my problem. Instead to give a path to the transferTo method i now I give it a new file.
fileUpload.transferTo(new File("/path/to/folder/data.zip"))

Files and folders in File Manager are not displayed in Roxy file manager in MVC?

I project myself that I used the MVC used for managing files from Roxy File Manager! Everything is correct and complete project works!
My problem is when the server I'm Publish project was a project file, but the file does not show !!!!! I do not know where is the problem?
I "main.ashx" settings is as follows got the "GetFilesRoot"
ret = _context.Server.MapPath("/Uploads/Web");
This is when the host is not the answer! I also tried different ways !!
With ~ no ~
With . . Without . .
First /
The first / deleted
Just put ~
I tried every way I knew it was not OK, but that was not
It's my system files run the show
It does not run on the server where the file
Probably your web server doesn't know how to serve .json files.
Open IIS Manager.
Display properties for the IIS Server.
Click MIME Types and then add the JSON extension: File name extension: .json and MIME type: application/json
More info

Unable to upload image on mvc 4 web application hosted on windows azure

I have developed a web application using ASP.Net MVC 4, then hosted that web application on windows azure (windowsazure.com).
My website is unable to upload image/create file. Should I add some permissions?or how to add these permissions?
Please use Edit question to provide code snippet.
Give the code you've provided, the failing part is most probably the line:
Server.MapPath("~/UploadImages/" + ...);
What you really have to do, is first check whether that folder already exists:
string targetFolder = Server.MapPath("~/UploadImages");
if(!System.IO.Directory.Exists(taretfolder))
{
System.IO.Directory.Create(targetFolder);
}
// then copy the file here
The "problem", if one can say it is a problem at all, is that the server does not have this directory created when you try to put file into it. You have to first the directory before trying to copy files.
And by the way, it is not an "Azure" issue. If you take your code as is and upload it to a hoster (without manually creating or coping the UploadImages folder) you will encounter the very same issues.

Download FTP directory contents to ios

I have a website, let's say it's "http://www.jwilkthings.com/stuff"
I have a bunch of .txt files stored on this website, i.e. "http://www.jwilkthings.com/stuff/text1.txt"
What I'm wanting to do is find a way in iOS to download all of those text files without knowing what the document name is. I can already retrieve them manually as long as I have a file name, but I would rather just get all of them at once and put them in the documents directory if possible. I currently use FileZilla to upload all of the text files, so I can use FTP if needed.
The correct way to solve this problem is to not use FTP (riddled with performance and security issues), and to configure your web server to expose a table of contents directory listing that your client can parse.
But that's not an answer to your question.
If you really want your iOS app to speak FTP, take a look at the SimpleFTP sample project from Apple.
It's old, but I just got it to build on iOS 5. The ListController.m file has the code you're looking for.

How can I make a server log file available via my ASP.NET MVC website?

I have an ASP.NET MVC website that works in tandem with a Windows Service that processes file uploads. For easy maintenance of the site, I'd like the log file for the Windows Service to be accessible (to me, only) via the website, so that I can hit http://myserver/logs/myservice to view the contents of the log file. How can I do that?
At a guess, I could either have the service write its log file in a "Logs" folder at the top level of the site, or I could leave it where it is and set up a virtual directory to point to it. Which of these is better - or is there another, better way?
Wherever the file is stored, I can see that there's going to be another problem. I tried out the first option (Logs folder in my website), but when I try to access the file via HTTP I get an error:
The process cannot access the file 'foo' because it is being used by another process.
Now, I know from experience that my service keeps the file locked for writing while it's running, but that I can still open the file in Notepad to view the current contents. (I'm surprised that IIS insists on write access, if that's what's happening).
How can I get around that? Do I really have to write a handler to read the file and serve it to the browser myself? Or can I fix this with configuration or somesuch?
PS. I'm using IIS7 if that helps.
Unfortunately I'm afraid you'll have to write a handler that will open the file, and return it to the client.
I've written an IIS Manager extension that displays server log files, and what I've noticed that even the simple
System.IO.File.OpenRead("")
can still run in the same problem, and return the same error.. It was kind of confusing.
In the end I used
System.IO.File.Open("", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
and I could easily open the file while the server was writing logs to it :)
I think the virtual directory is an "okay" solution, if you add the directory (application) with READ ONLY rights + perhaps "BROWSE directory" too (so you can see the folder contents rendered by the IIS).
(But once you do that, you should consider that you also anonymous access to that folder - unless you enable authentication, so watch out for "secret" contents of the logfiles that you might expose? just a thought.)
Another approach, I prefer myself, is to make a MVC/ASP.NET page that does the lookup in the folder by normal code, so that you 100% can filter whatever data is shown in the HTML.
You can open the files as TextStream's and in Read Only mode.
If it's a problem to gain access to the logfolder, I would use the virtual directory with READ ONLY access and then program something that renders the logfiles as HTML on my screen and with my detail levels. Perhaps even add some sort of "login" first. But it all depends on your security levels and contents of logfiles.
is this meaningfull to you? if not, please explain more, as I've been through this thought a few times already for similar situations.

Resources