Get requested webpage URL with asp.net
Sometimes its useful to know what web page has been requested by your web browser.
Geocode with google maps api in ASP.Net
I have spent many hours trying to find a free way to do postcode lookups and obtain the longitude and latitude. A few websites provide this service, but unfortunately i have found that after a few months the websites no longer work, or restrict the number of lookups each day.
Change the document type using MIME
When any webpage is returned back to the browser a type is specified which indicates what type of document is being returned. Normally this would be a standard html document and this is rendered in the browser.
Case insensitive replace on a string
I'm sure everyone is familiar with the replace function which replaces all occurances of a string with another string, however this can also be done with the same function but ignoring the case of the compare string.
Setup a 301 permanent redirect using asp.net
A permanent 301 redirect is very usefull if you have recently moved or redesigned your website. Search engines will have references to your old pages and also any links from other websites may refer to your old pages. To keep any search engine ranking then you must add this redirect, and over time all the references will update to your new pages.
How to compress webpages with gzip using global.asax
Almost all modern webbrowsers support gzip compression, and its recommended to use this to reduce the size of webpages which in turn can dramatically reduce the download time.
Remove HTML tags from string with RegEx
If you have done a scrape of some data from a webpage, then the obtained string could contain lots of HTML tags such as HREF entries or font formatting. This may not be desirable when that information is displayed on your own site.
Set and retrieve cookies in ASP.NET
You may wish to set cookies on your webpage which are usefull for things like login areas. This can be done with session variables, but i find those to be less reliable and are regularly cleared when new files are uploaded to the server.
Read in the contents of a webpage to a string.
You may wish to display the contents of a feed from another website or grab data from another website and perform some processing on this information and then redisplay on your own site.
How to dynamically create a word document in ASP.NET
The easiest way i have found to generate a word document from website content is to use the feature of word to read in HTML documents and display as a normal word document.
- 1