URL Aliases: Rewrite, Routing, Not Sure

Dec 15, 2010

ASP.net 4.0 / IIS7.

I want to "alias" a single web form to appear as various extensionless urls. Given a form in my web root called "mySite.com/ColorWebForm456.aspx":

I want it served as multiple names, e.g., mySite.com/Color, mySite.com/Colour, mySite.com/Colors, mySite.com/Coler, etc., without creating folders and duplicate forms with those names.I never want mySite.com/ColorWebForm456.aspx displayed in the browser, it needs to display as mySite.com/Color, even if the user somehow acquires it and types in that exact ~.aspx address. The variations will account for several alternate or mis-spellings users might attempt - I don't want them "corrected", however. So, if a user types in mySite.com/Colour, the url is NOT rewritten to mySite.com/Color, but the same page is served via ColorWebForm456.aspx as the requested "mySite.com/Colour".

I've seen so many articles on this that I'm not even sure where this would be best handled: in Global.asax, IIS7 URL Rewrite, web.config, etc., and I'm not even sure this is technically a case of url rewriting or routing... ?

View 4 Replies


Similar Messages:

C# - Transform URL Without Routing Or Rewrite?

Jan 13, 2010

I am using ASP.NET 2.0 on IIS6 therefore I can't use system.web.routing. I've tried a few URL rewriters but none did what I wanted.I basically need to transform (read/parse then redirect) URL 1 into 2 with minimum IIS configuration because I don't have the full authority to reconfigure web servers (i.e. ISAP on IIS6 or install 3rd party extensions/libraries). And I can't transform URL into 3 because all the physical links will break. [URL]

View 3 Replies

How To Use System.Web.Routing To Not URL Rewrite In Web Forms

Jan 12, 2010

I am using System.Web.Routing with ASP.NET (3.5) Web Forms that will URL rewrite the following URL from

http://www.myurl.com/campaign/abc

http://www.myurl.com/default.aspx?campaign=abc

The code is as below:

public static void RegisterRoutes(RouteCollection routes)
{
routes.Add("CampaignRoute", new Route
(
"{campaign_code}",
new CustomRouteHandler("~/default.aspx")
));
}
IRouteHandler implementation:
public class CustomRouteHandler : IRouteHandler
{
public CustomRouteHandler(string virtualPath)
{
VirtualPath = virtualPath;
}
public string VirtualPath { get; private set; }
public IHttpHandler GetHttpHandler(RequestContext
requestContext)
{
if (requestContext.RouteData.Values.ContainsKey("campaign_code"))
{
var code = requestContext.RouteData.Values["campaign_code"].ToString();
HttpContext.Current.RewritePath(
string.Concat(
VirtualPath,
"?campaign=" + code));
}
var page = BuildManager.CreateInstanceFromVirtualPath
(VirtualPath, typeof(Page)) as IHttpHandler;
return page;
}

However I noticed there are too many things to change on my existing aspx pages (i.e. links to javascript, links to css files).

So I am thinking if there's a way to keep above code but in the end rather than a rewrite just do a Request.Redirect or Server.Transfer to minimize the changes needed. So the purpose of using System.Web.Routing becomes solely for URL friendly on the first entry.How to ignore the rest of the patterns other than specificed in the code?

View 1 Replies

URL Routing Rewrite Path But Keep Mimetype?

Feb 19, 2010

I have implemented my own IRouteHandler for URL routing. For files without extension it will try to load the filename as a Page from the Pages directory with:

return (IHttpHandler) BuildManager.CreateInstanceFromVirtualPath(path, typeof(Page));

However there are also images and css files (with relative paths) that need to be translated to the correct url. I try to service those files with:

try {
HttpContext.Current.Server.Transfer(fileName);
} catch (HttpException) {
throw new HttpException(404, "file not found");
}

This works fine (in Internet Explorer), however Firefox is giving me an error:

Styles.css was not loaded because its MIME type, "text/html", is not "text/css".

Is this caused by the Server.Transfer? What should I use to redirect the file? Response.Redirect is visible to the client.

View 1 Replies

Web Forms :: URL Routing And DataPager Control - How To Rewrite App

Sep 13, 2010


we are using URL Routing so a path like

[URL] would be output like [URL]

we have a data pager on the page that ties to the list view.

the data pager when changing pages reverts the url back to the un-routed version (like[URL])

how can i re-write this back to something more friendly for my app

ideally it would be great to have it look sometihng like /news/page/2

i can use IIS 7's new re-write module - already using it to remove trailing slashes.

View 2 Replies

ADO.NET :: Set Aliases In LINQ Entities Framework?

Jul 29, 2010

i have a table with a field name called 'Firstname' and another field name called 'Lastname'. I would want to have a single column in my GridView which show Fullname and then the firstname and lastname are showed here under an alias. Also, i am binding my GridView using LINQ.So is there a way to create aliaswith LINQ and to use these with GridView ? Would love to have an hint about how i can realize this task.

View 5 Replies

Web Forms :: Web.Routing Doesn't Work On Server On IIS Routing

Jul 20, 2010

I tried everything I could find, but still does not work on IIS routing.

View 2 Replies

Routing With Web Forms - Could Not Load System.Web.Routing

Dec 12, 2010

I am using:

ASP.NET 3.5 SP1 with Web Forms Routing thru Global.asax (System.Web.Routing and RegisterRoutes)IIS 7

Everything is working fine in my local machine, but it gives the following error in my hosting environment:

Could not load file or assembly 'System.Web.Routing, Version=3.5.0.0, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I did everything inside my web.config file mentioned in the following link:

[URL]

But I am still getting the above error.

What else am I supposed to do fix the error?

View 1 Replies

Rest WCF Url Routing & Web Forms Routing?

Feb 22, 2011

I have a Web application where i have added a reference to a RESTful WCF. I got the WCF url Routing to work in my webapplication by adding Inherits="RestService.Global" to the Web applications Global.asax.

<%@ Application Codebehind="Global.asax.cs" Inherits="RestService.Global" Language="C#" %>

But then i tried to create url Routing for the Web application and it does not work with the Inherits="RestService.Global" in the Global.asax. If i take it away it works fine. Is there a correct way to do this.

View 1 Replies

Web Forms :: URL Routing And Dynamic Routing?

Jan 31, 2011

I'm trying to create my own CMS and I've gotten a little bit stuck at the stage of URL routing.

I want clean URLs without extensions and I'd like to be able to create and modify them in a web based interface without any messing around with IIS or actual files.

I've seen how to create a static route, but for that I need to go into my Global.asax file and manually add it.I would like to have all of these routes stored in a database so that I can easily modify them later.

Does anyone know how this can be achieved?

Just for extra information, I will be attempting to create a feature so that if a path exists, but is later changed, a 301 redirect is created to the new URL, is this also possible? (My first problem is the main issue, but thought I might ask this as well just in case it makes a difference)

View 2 Replies

Handle MVC Routing Along With Webform Routing

Sep 2, 2010

How to handle asp.net mvc routing along with asp.net webform routing. I have merged my mvc app into my existing web application. In my web application i have implement routing as below:

routes.Add("View Product Details", new Route("Product/{City}/{Manufacturer}/{Name}/{ProductID}/{*ProductType}"));

Similarly i have implemented routing in mvc as below

routes.MapRoute("Product Details",
"Product/{City}/{Manufacturer}/{Name}/{ProductID}/{ProductType}",
new
{
controller = "Home",
action = "ProductDetails",
City= UrlParameter.Optional,
Manufacturer= UrlParameter.Optional,
Name= UrlParameter.Optional,
ProductID= UrlParameter.Optional,
ProductType= UrlParameter.Optional
});

How to handle both pages, as one is custom web form while other is asp.net mvc view?

View 1 Replies

MVC :: How To Permanently Redirect Url From Old Routing Rule To New Routing Rule

Nov 30, 2010

Response.RedirectPermanent(Url); can redirect permanently to a url.

However, during my SEO process, I decided to change my routhing rule.

For example,

I change "/tag/{tag}-quotes" routing rule to "quoes-about/{tag}", but I don't want to lose all the traffic to old routing url.

What is the best way to handle this permanent redirection?

View 4 Replies

URL Rewrite IIS 2.0?

Jul 1, 2010

I have an URL like that :

/eng/myfolder/mycategory.aspx
I would like to transform it in something like:

index.aspx?FolderId=2&LanguageId=1&CategoryID=12

In a word I want to "write" that,

eng => languageId=2 and myfolder => FolderId=2 and mycategory.....

I don't know if i make myself clear but

with http://mywebsite.com/fr/default

Right Now i have :

<add key = "/en/default" value = "default.aspx?LanguageId=1" />
<add input = " {Rewrite:{REQUEST_URI}}" pattern = "default.aspx?(.+)" />
<action type="rewrite" url="default.aspx?{C:1}" appendQueryString="False" />

But i want Something more global like:

<add key = "/en" value = "LanguageId=1" />
<add input = " {Rewrite:{REQUEST_URI}}" pattern = "(.+)" />
< action type="rewrite" url="default.aspx?{C:1}" appendQueryString="False" />

View 1 Replies

Web Forms :: Rewrite Url In C#?

Mar 11, 2011

Im building a small project.

I have the url : [URL]

View 6 Replies

Rewrite The Url In Forum?

Apr 5, 2010

I have a forum on my website

what i need to do is to rewrite the url :

[URL]

to

[URL] to dogracer players

Is there any quick way to achieve this.

The rewrite should be dynamic because each posts in the forum should have a rewritten url

View 5 Replies

How To Rewrite Url String. In With C#

Mar 3, 2010

how to rewrite url string. in asp.net with c#.net.

View 4 Replies

Configuration :: How To Rewrite Url In IIS

Oct 3, 2010

I am trying to rewrite url in IIS server.What would be the simplest steps for getting this functionalities in my website.

View 1 Replies

Link JS And CS When Rewrite Url

Jan 29, 2010

I use Intelligencia.UrlRewriter.dll My link CSS or JS is:

<link href="/css/theme.css" rel="stylesheet" type="text/css" />

it good on the internet,but on localhost the link is error ( i test on IIS and IIS ASP.NET ). so i have

<link href="my_domain/css/theme.css" rel="stylesheet" type="text/css" />

View 2 Replies

Best Way To Rewrite URLs?

Feb 16, 2011

I want to rewrite something like this:

www.webaddress.com/article.aspx?date=150211&title=title-of-news-article

to this:

www.webaddress.com/150211/title-of-news-article

Even to achieve the first link above, I need to replace capital letters and non-standard characters like é with e, and replace spaces with hyphens. Is all of this possible using URL Rewrite Module 2.0 or might I be better off coding some ASP? I'm new to .net and may have to do something in classic if I struggle. And I only just get by in ASP...

I've tried some of the tutorials on the official IIS website and have got through a simple rewrite wizard, but replacing characters seems more complicated, and I'm sure some of the tutorials have errors in them...

View 6 Replies

Rewrite Url Address Using Vb.net?

Dec 8, 2010

just like the title is. When users land on the second page, after clicking submit on first page, i want the second page to read the url, then modify the aspx page in the end and send the user to a specific page.
e.g - www.abc.com/page1.aspx --> click submit --> redirect to www.abc.com/page2.aspx the code should read "/page2.aspx" and then rewrite it as "/page5.aspx" and automatically redirect to page5.aspx

View 3 Replies

Web Forms :: Rewrite URL In Address Bar?

Jun 10, 2010

Any one have idea about rewrite url in detailed,want step by step process about rewrite url.

View 3 Replies

Can Create Url Rewrite To A Domain In IIS 7

Nov 29, 2010

I'm using ASP.NET 3.5 with IIS 7 with the URL Rewrite Module 2.0 installed.When I create the first test rewrite rule:

<rewrite>
<rules>
<rule name="Test rule1" patternSyntax="ExactMatch">
<match url="w/123/test" />
<action type="Rewrite" url="article.aspx?id=123" />
</rule>
</rules>
</rewrite>
(http://www.myapp.com/w/123/test ->
http://www.myapp.com/article.aspx?id=123).

View 1 Replies

Url Rewriting - URL Rewrite And 3.5 Webform

Jan 21, 2011

how could i do advance url re-write in asp.net3.5. when we post question in stackoverflow then our question is listed as hyperlink like below one. What is dependency injection? when we click on link then a dynamic page is show. so i want know if there is a hyperlink which have href like [URL] actualy i want that when user click on above link then user will be redirect to page where url will be shown in address toolbar like [URL]. how could i achieve it without touching IIS. how to write the code.

View 1 Replies

C# - Url Rewrite For Aspx Page?

May 7, 2010

I have a page, called foo.aspx and i d like to rewrite the url as bar.somethingHow to do this? How does url rewrite happens in asp.netShould i create a generic handler?or should i get some url rewrite modules and add to app?

View 3 Replies

Tag With Javascript And IIS 7 URL Rewrite Module

Jan 26, 2010

I use IIS 7 URL Rewrite Module and it works fine.

But My javascript code doesn't work anymore on the page (details.aspx) where i use URL Rewrite Module.

Example :

<a href="#" target="popup" onclick="wopen('note.aspx?ID=<%#CType(FormView1.DataItem, System.Data.DataRowView).Item("NoteID")%>&S=<%#CType(FormView1.DataItem, System.Data.DataRowView).Item("IsS")%>','popup',480,480); return false;">
Write a note</a>

If i disable the rule in IIS, this link works as expected.

The Rewrite rule doesn't include the note.aspx page.

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved