Providing .jad file download link - iis

We are trying to provide a download link to abc.jad file in index.html. abc.jad and index.html are both in the same folder. Following is the link.
download
In addition, we defined the mime type for .jad file in web.config as follows
<mimeMap fileExtension=".jad" mimeType="text/vnd.sun.j2me.app-descriptor" />
In spite of these, we are still not able to download this file from the web browser. It always gives the error HTTP Error 404 - File or directory not found
The server is IIS with .net 2.0
Can you please help?

i know is a little bit late but you are missing these MIME types:
(you have to set these types to your folder on IIS Admin Console)
.cod
application/vnd.rim.cod
.jad
text/vnd.sun.j2me.app-descriptor
.jar
application/java-archive

Related

Could not read log4j.properties

We are having a module which contains log4j.properties and other files in it. And there is a separate module which is dependent on the 1st module(Realign). So we had made the 1st module as a jar file and placed it in the WEB-INF/lib folder of the second module(Reasign). We are running the modules in Liberty server. But still we are getting the File Not found exception as below,
log4j:ERROR Could not read configuration file
[file:/metlife/runtime/installed/wlp/usr/servers/bobr/apps/expanded/bobr.ear/BOBReassignmentWeb.war/WEB-INF/lib/Realignment.jar!/r_resources/log4j.properties].
[9/12/18 8:28:51:591 EDT] 000002de SystemErr R java.io.FileNotFoundException:
file:/metlife/runtime/installed/wlp/usr/servers/bobr/apps/expanded/bobr.ear/BOBReassignmentWeb.war/WEB-INF/lib/Realignment.jar!/r_resources/log4j.properties (No such file or directory)
It looks like your PropertiesConfigurator class is taking a file path (as a String). If you used a URL instead, I think that would work - that way, you would get a JAR URL which includes the path to the JAR (or WAR, EAR, etc.) archive and the path inside the JAR. If you have control over the PropertiesConfigurator code, then I would recommend changing it so that it loads the file via URL.
If that is not an option, then you could extract the properties files and put them on the file system directly. For example, you could create a directory in your server directory (for an example, we'll call it log4jProps). Then you could create a shared library in your server config (server.xml) like this:
<library id="log4j.props">
<fileset dir="${server.config.dir}/log4jProps" includes="r_resources/*properties"/>
</library>
then update your application configuration to use this library as a common shared library:
<application id="myApp" name="myApp" location="myApp.war"...>
<classloader commonLibraryRef ="log4j.props" />
</application>
For good measure, you should probably remove the properties file from your application archives - that way they won't be loaded from there, and then throw off the PropertiesConfigurator like it is now.
Hope this helps,
Andy

404 when trying to serve static files with non-english characters

I have Windows 2008 R2 Server with IIS 7.5.
I am trying to serve static files with non-English (Hebrew) names, but cannot get it working.
I have 4 files:
a.jpg
א.jpg
b.txt
ב.txt
When I try to go to http://.../a.jpg and http://.../b.txt, I am getting the right files.
But when I try to access http://.../א.jpg or http://.../ב.txt it won't work.
Even if I encode the file names before going to url i.e http://../%D7%90.jpg it won't work as well.
I am getting a regular 404 server error:
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
I tried the following, but it didin't help:
1.adding globalization settings to web.config:
<configuration>
<system.web>
<globalization
fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
</system.web>
</configuration>
2.adding .jpg and .txt to MIME Types settings in IIS.
What am I missing here?
I found a solution to this problem.
It was all about UrlScan IIS extension...
All I had to do is:
Go to the UrlScan folder inside windir%\system32\inetsrv [32bit] and %windir%\syswow64\inetsrv [64bit]
Open UrlScan.ini and change AllowHighBitCharacters to 1

Orchard CMS: Resources getting a 404 (Not Found)

I'm creating a theme for Orchard CMS 1.10. I'm using a Bootstrap template as a basis. There are quite a number of CSS and JavaScript files that I'm including. All of them however are not being found.
I created a ResourceManifest class to define them:
manifest.DefineScript("ThemejQuery").SetUrl("~/Scripts/plugins/jquery-1.11.3.min.js");
manifest.DefineScript("Bootstrap").SetUrl("~/Scripts/plugins/bootstrap/js/bootstrap.min.js").SetDependencies("ThemejQuery");
manifest.DefineScript("jQueryScrollTo").SetUrl("~/Scripts/plugins/jquery-scrollTo/jquery.scrollTo.min.js").SetDependencies("ThemejQuery");
manifest.DefineScript("BackToTop").SetUrl("~/Scripts/plugins/back-to-top.js").SetDependencies("ThemejQuery");
and am calling them so in my Document.cshtml:
Script.Require("jQuery").AtFoot();
Script.Require("Bootstrap").AtFoot();
Script.Require("jQueryScrollTo").AtFoot();
Script.Require("BackToTop").AtFoot();
In each directory that these css and js files reside, I'm including a web.config file to allow access:
the web.config files all look like:
and yet none of these files are being served. I don't believe that the paths are an issue, e.g. using '~/Scripts'. The paths are correct (as far as I can see):
I've googled the hell out of this but cannot find a solution. I've tried running this within IIS Express in Visual Studio as well as full-blown IIS. Any ideas?
You need to change the addHandler of your web.config (inside Scripts or Styles) addHandler like:
<add name="StaticFileHandler" path="*" verb="*" modules="StaticFileModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
Drop the '~/Scripts', the resource manager looks for scripts in the modules 'Script' folder and for styles in the 'Styles' folder.

How to allow web.config files as normal files and allow download IIS inside a virtual directory

I am working on a Unity 3D game which upon build for Windows generates game.exe and game_Data file and folder. The Game_Data folder contains a directory called **Game_Data\Mono\etc\mono\2.0**.
The directory files are shown in image.
The Browsers directory contains one file called Compact.browser.
The Current Scenario.
1. These game files are hosted on a server where IIS 7.5 is running.
The game resource files are served in virtual directory of the game website.
I've made few changes to the website's root web.config file so that all filetypes are allowed to download only in the game resources folder on server.
Yes, all file types including .html, .aspx, .xml, .config, .browser, .map etc are all downloading as normal files.
The problem
As you see the directory structure there is a web.config file inside the game resources folder. The file has nothing to do with website configuration but with the game (which is on client side after downloading).
As the files are served as individual files each file is downloaded separately. So when the client tries to download all files including the contents of the above folder.
Due to this web.config file, contents of the directory is not downloading. If I delete this web.config file all of the .aspx, .config, .map files are downloading. Also there are some other folders where many different files are downloading properly.
But this web.config file is also required for the game, and it is not allowing it be downloaded with other files too in the directory shown above.
I've tried to look into the solution. Found some hints to avoid inheritance in nested config files. But actually I want to completely treat this file as a normal file, not as a site configuration file.
I think you got my problem. Please let me know your suggestions. You can say adding Mime types. But actuall all of the file types are downloading including .config files. Except the file named web.config.
I'm having the same problem, and I think I found the solution: there is a way to tell IIS not to interpret web.config files.
To do this, modify the C:\Windows\System32\inetsrv\config\applicationHost.config file (I haven't found a way to do this in the IIS user interface), by specifying allowSubDirConfig="false" for the relevant <virtualDirectory> element:
<configuration>
<system.applicationHost>
<!-- ... -->
<sites>
<site name="Default Web Site" id="1">
<application path="/">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
<virtualDirectory path="/Staging" physicalPath="C:\inetpub\wwwroot\Staging" allowSubDirConfig="false" />
</application>
<bindings> <!-- ... --> </bindings>
</site>
See http://www.iis.net/configreference/system.applicationhost/sites/site/application/virtualdirectory for the details.
The problem is, it still won't let you download the web.config file, it keeps returning a 404 - Not found, even after removing all handlers.
Edit - found the solution. The short answer is that in your web.config, you should clear the fileExtensions and hiddenSegments lists:
<system.webServer>
<security>
<requestFiltering>
<hiddenSegments>
<clear />
</hiddenSegments>
<fileExtensions>
<clear />
</fileExtensions>
</requestFiltering>
</security>
I've written a blog article about it that explains all the details.

Trying to create my .cspkg Azure package file, but getting an error "Need to specify the physical directory for the virtual path..."

When I try to package my Azure web app (to create the .cspkg and .cscfg files), I get the following error in my ServiceDefinition.csdef file:
Need to specify the physical directory for the virtual path
'AzurePOCWebRole/' of role AzurePOCWebRole
Here's my .csdef file:
I'm assuming the error is referring to my <Site name="AzurePOCWebRole"> piece. I try adding physicalDirectory to <Site name="AzurePOCWebRole" physicalDirectory="../AzurePOCWebRole">:
And try to create the package again, but I get the same error and it reverts that change I just made back to <Site name="AzurePOCWebRole">:
QUESTION: What can I do to resolve this error and create my package?
I was editing the "automatically generated" version of ServiceDefinition.csdef, which wasn't apparent because it didn't indicate it wasn't the actual file, so whenever I rebuilt, it reverted this file back to the original ServiceDefinition.csdef's file, which I WASN'T editing.

Resources