-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dumping existing solution (mostly) as-is.
- Loading branch information
1 parent
c77ce27
commit c3a415b
Showing
119 changed files
with
5,039 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
007ebd main blue header color bottom | ||
5cb4f7 lighter blue header color top | ||
e0ecf1 lightest blue highlighted matches in context | ||
5c8f4d green buttons top | ||
|
||
a5d6f0 light blue odd | ||
c1e044 light green even (and active nav) | ||
|
||
f7f7f7 input background | ||
f2f2f2 alt row background | ||
e2e2e2 page background | ||
cccccc default borders | ||
999999 table header row | ||
666666 main panel border | ||
464646 footer pages link highlight | ||
3f3f3f footer background | ||
333333 default text | ||
2e2e2e nav bar background |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
<%@ Application Language="C#" %> | ||
<%@ Import Namespace="System.Collections.Generic" %> | ||
|
||
<script runat="server"> | ||
|
||
void Application_BeginRequest(object sender, EventArgs e) | ||
{ | ||
Uri currentUrl = null; | ||
//if (Request.Url.AbsolutePath == "/NotFound.aspx" && Request.Url.Query.StartsWith("?404;")) | ||
//{ | ||
// // this is a 404 call in prod (example, http://regexstorm.net/NotFound.aspx?404;http://regexstorm.net:80/tester?this=that) | ||
// // extract the original url from the query string, remove the port, and use it as the current url | ||
// string url = Request.Url.Query.Substring(5); | ||
// url = url.Remove(url.IndexOf(":80"), 3); | ||
// currentUrl = new Uri(url); | ||
//} | ||
//else | ||
//{ | ||
// just a normal page request, use the true current url | ||
currentUrl = Request.Url; | ||
//} | ||
|
||
//ConsolidateVariants(currentUrl); | ||
//RedirectUrl(currentUrl); | ||
//RewriteUrl(currentUrl); | ||
} | ||
|
||
private void ConsolidateVariants(Uri currentUrl) | ||
{ | ||
// start with current url | ||
UriBuilder redirectUrl = new UriBuilder(currentUrl); | ||
|
||
// variant host strings (example, www.regexstorm.com) are consolidated to regexstorm.net | ||
if (currentUrl.DnsSafeHost != "regexstorm.net" && currentUrl.DnsSafeHost != "localhost") | ||
{ | ||
// modify host | ||
redirectUrl.Host = "regexstorm.net"; | ||
|
||
// if the path contains default.aspx, remove it before redirecting | ||
redirectUrl.Path = Regex.Replace(redirectUrl.Path, "/default.aspx$", "/"); | ||
} | ||
|
||
// remove trailing / for directories (example, http://regexstorm.net/tester/) | ||
if (currentUrl.AbsolutePath.EndsWith("/")) | ||
{ | ||
redirectUrl.Path = redirectUrl.Path.TrimEnd('/'); | ||
} | ||
|
||
// if anything on the redirect url was changed, then a redirect is due | ||
if (redirectUrl.Uri.ToString() != currentUrl.ToString()) | ||
{ | ||
// permanently redirect to new url | ||
Response.AddHeader("Location", redirectUrl.Uri.ToString()); | ||
Response.StatusCode = 301; | ||
Response.End(); | ||
} | ||
|
||
} | ||
|
||
private void RedirectUrl(Uri currentUrl) | ||
{ | ||
// there's an extra app directory in dev, which affects path logic | ||
bool isDev = (currentUrl.DnsSafeHost == "localhost"); | ||
|
||
// determine app relative path | ||
string appRelativePath = currentUrl.AbsolutePath.ToLower(); | ||
if (isDev) | ||
{ | ||
// remove app directory | ||
appRelativePath = Regex.Replace(appRelativePath, "^" + Request.ApplicationPath, "", RegexOptions.IgnoreCase); | ||
} | ||
|
||
// run through all cases where we want to redirect | ||
UriBuilder redirectUrl = new UriBuilder(currentUrl); | ||
switch (appRelativePath) | ||
{ | ||
case "/tester.aspx": | ||
redirectUrl.Path = "/tester"; | ||
break; | ||
case "/reference.aspx": | ||
redirectUrl.Path = "/reference"; | ||
break; | ||
case "/about.aspx": | ||
redirectUrl.Path = "/about"; | ||
break; | ||
} | ||
|
||
// if anything on the redirect url was changed, then a redirect is due | ||
if (redirectUrl.Uri.ToString() != currentUrl.ToString()) | ||
{ | ||
if (isDev) | ||
{ | ||
// put the app directory back in when in dev | ||
redirectUrl.Path = Request.ApplicationPath + redirectUrl.Path; | ||
} | ||
|
||
// permanently redirect to new url | ||
Response.AddHeader("Location", redirectUrl.ToString()); | ||
Response.StatusCode = 301; | ||
Response.End(); | ||
} | ||
} | ||
|
||
private void RewriteUrl(Uri currentUrl) | ||
{ | ||
// only rewrite a url if it's to a folder (no file extension) | ||
if(!currentUrl.AbsolutePath.Contains(".")){ | ||
// get path segments array and toss the first segment (the root /) | ||
List<string> segments = new List<string>(currentUrl.Segments); | ||
segments.RemoveAt(0); | ||
|
||
// in dev, the next segment is the app (Website) directory, which we can also toss | ||
if (currentUrl.DnsSafeHost == "localhost") | ||
{ | ||
segments.RemoveAt(0); | ||
} | ||
|
||
// only continue if there are segments left (directory default urls will end here) | ||
if (segments.Count > 0) | ||
{ | ||
// do some massaging on each segment (remove trailing / and make lowercase) | ||
for (int i = 0; i < segments.Count; i++) | ||
{ | ||
segments[i] = segments[i].TrimEnd('/').ToLower(); | ||
} | ||
|
||
// alright, now we're ready for actual rewriting logic | ||
string rewrittenPath = null; | ||
|
||
if (segments.Count == 1) | ||
{ | ||
// single directory rewrites | ||
switch (segments[0]) | ||
{ | ||
case "tester": | ||
rewrittenPath = "~/Tester.aspx"; | ||
break; | ||
case "reference": | ||
rewrittenPath = "~/Reference.aspx"; | ||
break; | ||
case "about": | ||
rewrittenPath = "~/About.aspx"; | ||
break; | ||
} | ||
} | ||
|
||
if (!string.IsNullOrEmpty(rewrittenPath)) | ||
{ | ||
// execute rewrite, passing current query string along | ||
HttpContext.Current.RewritePath(rewrittenPath, "", currentUrl.Query.TrimStart('?'), true); | ||
} | ||
} | ||
} | ||
} | ||
|
||
</script> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Search rankings! | ||
|
||
1/2/2010 | ||
".net regex tester" - page 22 | ||
"regex tester" - page 31 | ||
|
||
1/4/2010 | ||
".net regex tester" - page 21 | ||
"regex tester" - page 31 | ||
|
||
1/5/2010 | ||
(site gone for both searches!) | ||
|
||
1/6/2010 | ||
".net regex tester" - page 5 | ||
"regex tester" - page - page 22 | ||
|
||
1/9/2010 | ||
".net regex tester" - page 6 | ||
"regex tester" - page 24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Edit Module Mapping | ||
Request path: * | ||
Module: StaticFileModule,DefaultDocumentModule,DirectoryListingModule | ||
Executable: (empty) | ||
Name: StaticFile | ||
|
||
File or Folder | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll | ||
|
||
|
||
File path for 404 error: | ||
%SystemDrive%\inetpub\custerr | ||
\<LANGUAGE-TAG>\ | ||
404.htm | ||
|
||
(checkbox clicked) |
Oops, something went wrong.