CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of Url
var baseUrl;
var applicationUrl;
 
baseUrl = document.location.href;
baseUrl = baseUrl.substring(0, baseUrl.lastIndexOf('/'));
applicationUrl = baseUrl.substring(0, baseUrl.lastIndexOf('/'));
by Warren Wiltshire   May 02, 2012 @ 5:24am
17 Views
no comments
 
C#
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
 
namespace System.Text {
    public static class StringTransformer {
        static readonly string linkFormat = "<a href=\"{0}\" title=\"{0}\" target=\"{2}\" class=\"{3}\">{1}</a>";
 
        /// <summary>
by SandRock   January 20, 2012 @ 11:21am
Tags: C#, url, html, link
105 Views
no comments
 
C#
//using System.Web; 
 
//to return "http://www.samplepage.com/Egli/index.aspx"
string url = HttpContext.Current.Request.Url.AbsoluteUri;
 
//to return "/Egli/index.aspx"
string path = HttpContext.Current.Request.Url.AbsolutePath;
 
//to return "www.samplepage.com"
string host = HttpContext.Current.Request.Url.Host;
by Egli   July 25, 2011 @ 9:18pm
169 Views
no comments
 
C#
/// <summary>
/// Get the file that will be read/written to
/// </summary>
/// <returns></returns>
public UnifiedFile GetFileFromProperty(PageData page, string propertyName)
{
    var filePath = page.Property[propertyName] != null
                       ? (string)page.Property[propertyName].Value
                       : string.Empty;
    if (string.IsNullOrEmpty(filePath)) return null;
by rawbert   February 25, 2011 @ 12:45am
292 Views
no comments
 
NSData *soundData = [NSData dataWithContentsOfURL:url];
AVAudioPlayer  *avPlayer = [[AVAudioPlayer alloc] initWithData:soundData error: nil];
[avPlayer play];
by Yuzhen Situ   June 03, 2010 @ 1:28am
557 Views
no comments
 
C#
DECLARE_EVENT_TABLE()
  
/***************************************************************
* Name:      downloadMain.h
* Purpose:   Defines Application Frame
* Author:     (alan)
* Created:   2008-11-14
* Copyright:  (谦泰通讯)
* License:
**************************************************************/
by efree   May 12, 2010 @ 11:55pm
206 Views
no comments
 
C#
public static class TinyUrl
    {
        private static readonly Random Random = new Random();
 
        public static string Get()
        {
            int random = Random.Next();
            return Base62ToString(uint.MaxValue);
        }
by Mikael Henriksson   April 30, 2010 @ 5:18am
Tags: TinyUrl, C#
293 Views
no comments
 
C#
public class URLRewriterModule : IHttpModule
    {
        /// <summary>
        /// You will need to configure this module in the web.config file of your
        /// web and register it with IIS before being able to use it. For more information
        /// see the following link: http://go.microsoft.com/?linkid=8101007
        /// </summary>
        #region IHttpModule Members
 
        public void Dispose()
by ZeroDotNet   February 22, 2010 @ 11:04pm
382 Views
no comments
 
<?php
function search_string($start , $end , $from, $number=1){
    if($number<1){
        $number=1;
    }
    $from = trim(str_replace("\r\n","",$from));
    $i = 0;
    $ans = $from;
    if(!stristr($ans , $start)){
        return false;
by b123400   January 31, 2010 @ 11:57am
523 Views
no comments
 
C#
public static class zlnkREST
    {
        static string CONST_UN = "twtmug"; // User your own UserName in Case you wanna track all your posts,
        static string CONST_Service = "http://zlnk.net/zlink.svc/";
        static string CONST_GetOriginalURL = "GetOriginalLink?ShortCode={0}&UN={1}";
        static string CONST_Shorten = "CreateShortLink?oUrl={0}&UN={1}";
        static string CONST_Default = "http://twtmug.com/";
 
        public static string ShortenURL(string strUrl)
        {
by Laith   January 19, 2010 @ 7:19am
214 Views
no comments
 
C#
        /// <summary>
        /// URL-encodes a string for use with OAuth.
        /// </summary>
        /// <param name="toEncode">
        /// The string to encode.
        /// </param>
        /// <returns>
        /// A URL-encoded string where all of the encoded characters are upper-case.
        /// </returns>
        /// <remarks>
by Mehul Harry   December 15, 2009 @ 3:01pm
425 Views
no comments
 
C#
/// <summary>
/// This method returns a fully qualified absolute server Url which includes
/// the protocol, server, port in addition to the server relative Url.
/// 
/// Works like Control.ResolveUrl including support for ~ syntax
/// but returns an absolute URL.
/// </summary>
/// <param name="ServerUrl">Any Url, either App relative (~/default.aspx) 
/// or fully qualified</param>
/// <param name="forceHttps">if true forces the url to use https</param>
by Rick Strahl   September 05, 2009 @ 1:37pm
1564 Views
1 comments
 
//Generate an object like "window.location"(href,protocol,host,hostname,port,pathname,search,hash)
//Or return false
function fnConvertHref(href) {
  var pattern = /([a-z]+):\/\/([^\/:]+):?([\d]*)\/?([^?]*)\??([^#]*)#?([^#]*)/gi;
 
  if (pattern.test(href)) {
    return {
      'href'     : href,
      'protocal' : RegExp.$1,
      'host'     : RegExp.$2 + RegExp.$3,
by yuyu1984   July 22, 2009 @ 4:28am
260 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate