Wordpress with ASP.NET MVC - asp.net-mvc

I have Wordpress in a subfolder in my site named blog.
When I goto the url of my site /blog/ I get the error
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
This use to show the default theme and an empty blog.
I think it may be a routing problem with MVC?
Does anyone know how to correctly set this up or how the routes should be configured?

Try putting this in your RegisterRoutes handler in global.asax:
routes.IgnoreRoute("blog/{*subfolder}");
It might also work simply with blog/*, but I am not quite sure.

Related

Unable to open a published MVC Project

I'm a total beginner so sorry in advance.
I used VS13 to build a MVC project and published it to my webspace. Now I'm unsure which file or path I need to specify in my forwarding config in order to open the website.
I tried
/Views/Shared
to get _Layout.cshtml and
/Views/Home
to get Index.cshtml but none of these are working. I also changed some admissions but it always shows me this
Forbidden - You don't have permission to access / on this server.
when I'm trying to open the website.
Any ideas on what I'm doing wrong?
With MVC You don't access views like traditional ASP.NET WebForms i.e. /path/to/view.aspx. Everything is handled via routing & controllers.
By default you will have a HomeController which will have an Index action which is invoked via a GET request. Assuming you haven't changed any of the default routing configuration you would just need to navigate to www.domainname.com/home to see your Index page.
The default routing configuration looks like /controller/action/parameters, MVC will always work this way unless you tell it different. If you don't pass a specific action (like I didn't with the home url) the Index action of the controller is assumed.

Asp.Net MVC route exception

I am using MVC to develop my website. I am getting the following errors.
URL:http://www.abc.com/robots.txt
1. The controller for path '/robots.txt' was not found or does not implement IController.
URL:http://www.abc.com/blogs/post/whats-new-in-mvc
2. The controller for path '/blogs/post/whats-new-in-mvc' was not found or does not implement IController..
But i dont have the above mentioned url in my website. How the above url are generated? Can you please let me know the solution to fix the above issue?
The first one is used by search engines to index your website. It's a good practice to have a robots.txt file to your application. So you could add this file to the root of your site. As far as the second url is concerned, I have strictly no idea who is querying it. Maybe somewhere inside your site you have a link to this url?
But if you don't want to use this file you could exclude it from routing:
routes.IgnoreRoute("robots.txt");
Now when a search engine sends a request to this file he will also get a 404 but the request won't be routed through the MVC pipeline.

Asp.NET MVC in subfolder

i have searched here, googling (with bing;)) and try all the things i have found but i
dont get it running.
I have a subfolder created on my webspace at discountasp.net like "MySite". Then i
made a virtual directory with the control panel. I published the Site with Visual
Studio to the path
http://blablabla.com/MySite/. My Domain is pointed to this path too.
It looks good but the links like /Home/About/ becomes /MySite/Home/About/ and thats
(of course) doesnt work.
How can i change that ? I think its an routing issue.
Please help me.
To create your URLs you should use
#Url.Action(actionName, controllerName)
This will use the routes you specified and it will create correct URLs.
You can also use
#Html.ActionLink(linkText, actionName, controllerName)
To include images and stylesheets use
#Url.Content("~/Content/...")
I got it. Pointing my Domain directly on the subfolder and defining a
Outbound rewrite rule on iis solves my problem.

Trying to make Weborb .NET work with ASP.NET MVC

We have been using weborb for .net on an existing application for some time now and it has worked very well. We decided to rewrite our application in ASP.NET MVC and now I need to make weborb work with mvc. I have been getting a 404 the resource cannot be found error while trying to connect to the weborb.aspx page. I have added all of the appropriate entries to the web.config file and I even found this article explaining how to make the two work together
http://aspzone.com/tech/how-to-get-weborb-and-asp-net-mvc-to-work-together/
But to no avail. I can't make it work. Thanks.
If 404 is given then there is no such resource. Most likely the MVC tries to route the request and cannot find appropriate one.
Try to add ignore route in the beginning of routes registration. Something like this:
routes.IgnoreRoute("weborb.aspx/{*pathInfo}");
My problem was that I had the project set up incorrectly as a website and not an mvc application. Once I did that the route explained the blog post I referenced worked like a charm.

ASP.NET MVC issue

I have a ASP.NET MVC app and when I run it, it loads my Index action on my HomeController
by default ok.
But when I put in this URl I get 404 - Not Found error
http://localhost/MyGoogleApp/Home/Index
This is the same for any action I put in in Home Controller.
Something fundamentally wrong, any ideas?
Malcolm
You probably have a configuration problem with URL mapping in IIS itself.
I haven't worked much with IIS7, but I think this is what you should check:
Managed pipeline mode should be 'Integrated'.
web.config should include system.webServer with all standard stuff new MVC project puts there (I can't check what exactly right now).

Resources