How to get CDN with # in it in CSHTML(Razor) page - razor

How to get CDN with # in it in CSHTML(Razor) page
lets suppose we have # in the CDN and we want that script in CSHTML(Razor) page
but its giving error
how can i add this CDN as script

I faced same issue while working in a .Net Core app.
You need to escape the # symbol inside the cdn url. Simply replace #microsoft with ##microsoft.

# is its own escape character. Simply put in ##. Alternatively you can store the URL as a string variable and use that.

Related

Gitlist style git description

I installed gitlist on my developer server and i am trying to style the git description file of a git repository.
I tried to inject html code inside the description file but this is not recognized as html but as text.
After that, i tried to find and edit the php file of gitlist which is not allowing me to style the description file, but i didn't found something.
Is there anyone who could help me?
git-description-style http://dev.siggouroglou.gr/git-description-problem.png
From the GitList homepage:
GitList is free and open source software, written in PHP, on top of Silex and the Twig template engine.
Twig is often deployed with its escaper extension enabled, which is a relatively safe default setting. With this setting enabled, any text put into Twig templates will be escaped by default, e.g. HTML escaping will turn < into <. This extension also supports JavaScript escaping.
While this setting is enabled (and I recommend keeping it enabled), you can use the raw filter in templates to disable escaping of certain elements. This will require modifying the template code.
Assuming your description is in a variable called description, something like this in the appropriate template should do the trick:
{{ description|raw }}
Note that permitting raw output does decrease your security. Make sure you trust your users not to put anything harmful into their repository descriptions.

When a URL ends in a slash, does that mean they're using an index file?

My spider sense tells me that they're not using a folder with an index file for each page, like apple's for example where http://www.apple.com/iphone/ ends in a slash. I've seen it also at other personal sites. How are they able to do it?
They use rewrite rules in their .htaccess files, so /iphone/ could be a folder, or it could be a controller/action of their web application.
Check this link for more info:
http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Search and replace from a list of replacements

Using html import 2 plugin for wordpress, I've gathered a list of old file-paths and what they've been changed to.
Instead of bulking up my .htaccess with redirects, I was hoping there was a way to replace all the old links with the new ones.
For instance, i have a list:
oldlink1, newlink1
oldlink2, newlink2
oldlink3, newlink3
oldlink4, newlink4
and I want to replace every occurence of oldlink1 with newlink1. possible?
Are you asking about file and images paths in the post content? (1) Or are you asking about post permalinks to redirect the old .html URLs to new WordPress URLs without the .html suffix? (2)
1) For file image paths in post content, probably the easiest and most foolproof approach is to use a find/replace plugin that will provide a front end to the database so you don't run queries directly on the database.
Try http://wordpress.org/plugins/search-regex/ With it, you can find/replace post content, post meta, comment content, etc.
Search Regex adds a powerful set of search and replace functions to
WordPress. These go beyond the standard searching capabilities, and
allow you to search and replace almost any data stored on your site.
In addition to simple searches you have the full power of PHP's
regular expressions at your disposal.
2) For URL redirects, you can try http://wordpress.org/plugins/redirection/ which will allow a CSV import of URL redirects while logging 404s and redirects.
Redirection is a WordPress plugin to manage 301 redirections and keep
track of 404 errors without requiring knowledge of Apache .htaccess
files.... This is particularly useful if you are migrating pages from
an old website, or are changing the directory of your WordPress
installation.
With this script you can do a search & replace on your WordPress database. Just follow the instructions, and don't forget to remove the script after you're done.

How to use a CGI to redirect from an HTML page to another using POST?

I want to send parameters to a page via a redirect using a ruby CGI script; however, I want to do it as a post if possible (ie. not pass a parameter string in the URL). I have it working using a parameter string in the URL using the code below.
def redirect( new_page )
print "Location:#{new_page}\n\n"
end
redirect("aPage.html?name=bla&something=else");
As far as I have been able to research, I have not found a way to do this. One way around this without doing an html redirect is to open the html file in your CGI script and print it as you would when your CGI is generating the html. The only catch here is that you will have the URL to your CGI script in the address bar, it may be possible to do a redirect using .htaccess (though I can't say for sure if that will work).
Hope this helps! :-D

HTML Include file

I have a basic web application packaged as an EAR deployed on GlassFish.
The web module has some html files.
The html files have a common footer, an html file, that I would like to extract out and make an include.
When I do, and put:
<!--#include virtual="insertthisfile.html" -->
in an html file, it does not work.
Should this work?
This is a technique called Server-Side Includes (SSI). It may not be enabled on your web host. If it is, sometimes they force a .shtml extension to be required for included files, so try renaming your file insertthisfile.shtml.
If that doesn't work, you might be able to enable SSIs in a .htaccess file (assuming your web server is Apache). You can find instructions on how to do this by googling. There's a decent set here.
If that fails, I would contact your web host and see if they have SSIs enabled.
Should this work?
Perhaps, at some special settings, with some experienced programmer, this could be useful.
In my case the include statement seems to be ignored.
I could include some text with
(embed src="include.shtml")
(/embed)
Above, I type () instead of angular brackets.
With the "embed", the setting in the header of the page does not apply to the included text; it should be repeated again, and, by default, the result is ugly.
It looks strange, as if the designers of the html did not build-in the very basic tool, the include command. For short articles, the include could save an order of magnitude in the size of files.