I have an ASP.NET website in framework 4.0
This website contains a subvirtual directory say directory1.
I want to add routing like when I type in browser
www.mydomain.com/funds it will get contents from www.mydomain.com/directory1
Example 2
**www.mydomain.com/funds/page1**
it will get contents from
**www.mydomain.com/directory1/page1**
URL in browser should remain **www.mydomain.com/funds/page1**
I have added reference of System.Web.Routing for this purpose. Initially tried with routes.MapPageRoute but there are no physical pages as directory1 is an wordpress website.
Any suggestions will be appreciated
Thank you
You may try URL Rewrite if you're using IIS for hosting website.
Related
I'm working on some app in asp.net mvc5. I have problems with redirection.
I'm using HttpContext.Current.Response.Redirect("www.google.com"); but the problem is that when I deploy on IIS i have web page on subdomain like somedomain.com/MyApp so when I use HttpContext.Current.Response.Redirect("www.google.com"); it creates link like somedomain.com/www.google.comso this is where the problem is. I don't now how to get rid of that subdomain ?
David
You need to qualify the protocol you are using, otherwise your addresss tring will be treated as a relative path.
For example:
HttpContext.Current.Response.Redirect("https://www.google.com")
Hi
We have a CMS application that lets people create websites under our domain.
The system was built a few years ago and it used a method that transfers parameters such as website id, folder code and more using the url. this method created a giant url for every item in the website
For example:
My domain is www.domain.com
A users website on my domain is www.domain.com/user
and every time that a user enters his website he gets a link like this
www.domain.com/page.aspx?code=blablasdsdsdsdsds&folder=blablablablablabla and more.
We are trying to reduce the string size in the url.
What are our options? can we show the user one url like a virtual one and still work the same with the old url?
We are trying to locate a solution that wont make us rewrite our entire application.
the application is built in c# and the web server is iis 6.
Thanks
You are searching for URL rewriting.
For IIS7 this functionality is build-in via the URL Rewrite Module.
For IIS6 you should read this MSDN article to follow the details on how to do it:
URL Rewriting in ASP.NET
Or you could go with one of the numerous third-party tools to do it:
UrlRewritingNet.UrlRewrite
UrlRewriter.NET
Ionics Isapi Rewrite Filter
ISAPI_Rewrite
Can anyone please help me with this?
I have a Windows 2008 server and MVC 2.0 site is hosted under IIS 7.0 root directory. The site works fine. I want to use the BlogEngine.NET with my site. For example if my mite name is http:// mysite.com (which is the root of IIS) and the blog should be http://mysite.com/blog/Default.aspx
Is this possible? Can I create a sub virtual directory within my root (where the MVC 2 app is hosted) and run the ASP.NET BlogEngine.Net in it?
Any ideas appreciated.
If you did decide to go with a single web application, you may find the following links useful:
http://redditech.wordpress.com/2009/02/16/howto-convert-blogenginenet-from-web-site-to-web-application-project/
http://www.upfromthesky.com/blog/post/2009/01/30/Integrate-BlogEngine-145-into-an-exisitng-website-%28VSNET-Website-Project%29.aspx
I've currently got a blog running at mysite.com/blog - it seems to be working fine, I'm just in the process of consolidating the membershipservices to work with my existing credentials.
There are important comments on the first link that you will probably need to do to get extensions working correctly.
Cut off the /blog app from MVC app using
<clear />
under
<system.web><pages><namespaces><clear />
For more details check this link.
http://www.dondraper.com/2010/02/how-to-stop-inheritance-of-webconfig-files/
I have deployed my ASP.net MVC site to a shared hosting company. The problem is that now none of the pages except for the home page work. For example if I go to /Account/Register I get a page not found. However, if I go to /Account/Register/Index.aspx then it does work. I have tried modifying the routing to add in that index.aspx but everything I have tried fails.
Sounds like you need to either
1) have a wildcard mapping set up in IIS (don't know if thats an option)
2) or setup the routes to include the extension ("{controller}.mvc/{action}/{id}").
Either way have a look at this post by Phil Haack: ASP.NET MVC on IIS 6 Walkthrough
I have an existing site in php running on Apache using the mod_rewrite plug-in. In other words, I currently have urls like www.example.com/section/subsection/ which Google and others have indexed.
However, the site needs a major upgrade, and I would like to move it to asp.net. I only have the option of using a shared hosting solution (iis 6, aps.net 3.5, full trust). So my question: How do I make asp.net do a 301 redirect from my old urls like www.example.com/section/subsection/ to their equivalent ones on the new asp.net site?
I obviously needs this to not loose the current rankings in the search engines.
Thanks, Egil.
If you use the ASP.NET MVC framework it has a URL rewriting system built into it.
You can manually add 301 redirects into IIS using IIS Manager if you want to set up "moved" locations.
If you want to do URL re-writing then you will need to implement IHttpModule, hook up the BeginRequest event, and add that new class to the httpModules section in Web.config.
Okay...so this may be overkill and could possibly be done another way in two lines..BUT...
If you are keeping the same domain name then what I've done in the past is keep a table of old urls and how they map to new urls. On the application's request, I'll scan the table, if an old url is found then I'll add a header that does a 301 redirect to the new URL.
According to Steve Sanderson’s blog post Deploying ASP.NET MVC to IIS 6 it do not look like there is an option to do url rewriting/redirection with IIS6 in a shared hosting set up, where you cant manually configure IIS. Gah...