Install components via Bower without SSL in ASP.NET 5 Starter Web project - asp.net

Due to corporate proxy issues I am unable to download components via Bower using https.
I know that normally you can get around this by adding
"registry": "http://bower.herokuapp.com"
to the .bowerrc file, but I can't seem to find it anywhere.
Please note that I haven't had Bower installed locally (as I am not intended to). I got bower.json from using the new ASP.NET 5 starter Web Project which has popular tools like Grunt and Bower built-in.
I wonder where this file is, or if there is any other way to replace https with http in the download url?
Update
I had to create the .bowerrc file manually and placed it inside the project root.
{
"directory": "wwwroot",
"registry": "http://bower.herokuapp.com"
}
Make sure you have wwwroot there as the directory. Doing this the output will now show with http.
However, this still doesn't resolve my problem - Bower still cannot download anything, nor can nuget. This is really strange 'cause if I create a normal web project using VS2015, nuget works fine...

The .bowerrc file can be located in one of the following:
Local .bowerrc located in the current working directory
All .bowerrc files upwards the directory tree
.bowerrc file located in user’s home folder (%USERPROFILE%)
bowerrc (without the dot) file located in %APPDATA%/bower/config
But setting the bower registry URL is probably not enough as bower will still need the https protocol in order to fetch package content from Github.

Related

PDF is not accessible through URL in IIS .NET Framework 4.8 app

I have a PDF file in a folder on a server within a IIS website app that I need to be able to open through a link/url, like below:
https://api.example.com/my-path/my-pdf-file.pdf
The PDF file is hosted in a folder of my IIS application. When I try to access it through the link, I've got a 500 server error.
I tried several things within IIS settings (URL Rules, web.config, mime-types), but nothing worked so far.
Any advice will be much appreciated.
Is the folder included in the project? You can't just add a folder outside of Visual Studio, but have to use VS to add that folder.
You can right click on that existing folder (which of course is a sub folder of your project) and check this setting:
So, in my case, I right click on UpLoadFiles.
If the folder ALREADY is included in the project, then you get a option to EXCLUDE the folder like this:
However, if the folder is not included, then you see this:
so, is that folder included in your project? You want to check above.

How to manually add a .txt file at page root in Gatsby JS?

I want to retrieve access to a Google Analytics account. Google has advised me to create an analytics.txt file at the root of the website such that htttp://my-site.com/analytics.txt.
How do you manually place a .txt file at the root of a site using Gatsby? Gatsby compiles JS files into HTML. I've tried manually placing an analytics.txt file in the /public folder but that doesn't seem to have worked either.
The Gatsby documentation is not helpful on this topic.
We are deploying the site using Netlify and storing the source code on Git Lab.
Any help would be appreciated.
If you create in your root project a folder named static, it will compile with the same name and internal structure in the public folder, so you will be able to refer to those files and assets in your React components. You can check for further information in their docs.
However, in your case, you may want to use a Gatsby plugin to place your analytics code. Here's the documentation.
In the scenario you've described, your solution didn't work because the public folder is regenerated in each build/compilation of code so your .txt is deleted in each compilation.

Netbeans step through out of project tree files for debugging (PHP)

I am writing a Wordpress plugin that depends on another plugin with netbeans.
The project is just containing the files of my plugin and I want to keep it that way to have a clean git repository.
The problem:
I rely on another plugin and want to understand how that plugin works. For this, I want to "step through" the other plugin.
I want to do this on my localhost configuration.
I have basically two destinations:
The project is in my home directory in my github folder
The server files are under c:\wamp64\www\wordpress ...., where the localhost is running
The project is essentially set up correctly to copy files from my github directory to the localhost path (Properties -> Sources)
Then:
I set an include path to the localhost -> wordpress folder in the project properties, and when I now search for a definition in my code that refers to the other plugin, the corresponding file is opened (did not work before setting the include path)
Debugging essentially works, but when I step into a function of the other plugin, the bar becomes grey and the corresponding file is not opened.
Can I change some setting for netbeans to open up the other file (not in the project tree) and step through it?
I have found a reasonable workaround.
I just created a new PHP project in Netbeans with existing sources.
As source, I used the entire wordpress installation in the wamp server path, i.e. c:\wamp64\www\wordpress
I can now 'debug' and step through this new project, but I also need to add the corresponding breakpoints in the files from the server path.
It requires some discipline as I have to open the files from my plugin twice, once in the server path and once in the project path, but only edit the files in the project path.
It works 'ok', but I would still be interested to hear if someone has a more proper solution to this.

How to run index.html file in Visual Studio 2015

I have an ASP.NET vNext project with the web start template. I've added a new html file and I wish to run it. However when I go to localhost:1111/index.html I get 404 error. Is there a special configuration in the grunt file?
The HTML file needs to be inside the root of wwwroot folder. You can move the file manually inside the folder and then edit it from inside wwwroot folder. Alternatively set up a Grunt task to copy it to the wwwroot folder using grunt-contrib-copy.
Depending on how you are hosting the project you will then have to enable static files. One way is to use the AspNet Static Files package.
In the project.json add with the beta version you are using (it is there by default in some project templates)
"Microsoft.AspNet.StaticFiles": "1.0.0-beta3",
In the Startup.cs tell the app to use static files (this is also added by default in some templates)
app.UseStaticFiles();
Then this should work...
Also the wwwroot folder is just the default in the starter template, you can change this by looking in the project.json file and changing the webroot property
"webroot": "wwwroot",
In your case you could change it to "." which would set the webroot to be the project folder but I think it is much better to have the "wwwroot" folder which makes it easier to control what can be accessed statically. If you use any languages which needs to be processed into static files, for example SASS and TypeScript, then it is a nice workflow to have the source files outside the webroot and then process them and set the destination to the webroot.

Can i put URL rewriting http module in a folder?

I am trying to make a generic URL rewrite methods, and i want it portable so i checked this article: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx which is very nice.
But i want to put all my classes, http modules in one folder, then i can just paste this folder in any asp.net website and edit the web.config to point to this http module, thats it, without the need to add anything in the APP_Code as this article teaching.
My question is is that possible? any conc or better ideas?
The ASP.NET runtime only looks by default in a limited number of folders for code files that it compiles on the fly -- App_Code (and its subfolders) is one of them. If you place code in an arbitrary folder, it won't be found.
The usual approach for what you describe is to build a DLL, and then drop it into the web site's bin folder. You would then have a separate project in Visual Studio for building the DLL. Using a subfolder in App_Code is another possibility.
You could also put your DLL into the GAC, which would make it accessible to all sites on a server.
You always can to compile that code into an assembly (.dll), place it inside your /bin folder and to update your web.config file.

Resources