I deployed my ASP.NET MVC app to the server. My Site name is: http://server_name/Company_Reports.
Everything works fine except when I redirect to some views.
For example when in .aspx web form I redirect:
Response.Redirect("/FCDReports/DailyReports/");
In my website the site name Company_Reports disappears and the Url becomes:
http://server_name/FCDReports/DailyReports/ and is not found because it should be:
http://server_name/Company_Reports/FCDReports/DailyReports/
How can I keep the site name Company_Reports in the url?
I'd appreciate any help.
Try this in Response.Redirect
Response.Redirect("~/FCDReports/DailyReports/");
Or
Response.Redirect("FCDReports/DailyReports/");
Related
I'm trying to add an MVC site under a domain where there is an existing site. The new site is just a simple mvc site to show a hangfire dashboard. I'm using IIS 8.5.
The current site is an old ASP.NET Web Forms site and will not allow the routing to the new MVC application and I get a 404.
The old site needs to be accessible at https://example.com and I need to be able to access the Hangfire site at https://example.com/Reporting/hangfire.
I have the MVC application configured and it works when the physical path of the Web Forms site is not pointing to the root folder (example.com).
I am new to the routing configuration in IIS so I am not sure if there is a URL Rewrite rule that would be useful for this or if need to do something else.
Edit
This is the root site, its a web forms site deployed by someone else. I added the MVC site as an web application and it uses a different app pool. I get a 404 in this case because the web forms app is handling the routing and its never getting to the MVC app.
I was able to get this working by deploying the site under a sub-domain; I had to convince our admin to allow this. The MVC site worked on its own but never when nested under the Web Forms site.
Good day!
I'm writing a very simple asp mvc 4 app which is a simple static site.
When i send a request from the site to app - I get the following error on my first attempt:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for
(or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /EmailSendApp/login.aspx
On my second attempt, i click "send" and my app works well!
Why is it not working the first time?
Thank you!
It is Intranet site and i use Windows authorization.
It is ASP MVC application with Windows authorization.
In MVC application we cannot write .aspx extension in browser url.In mvc application viewpage extension is .cshtml so please remove .aspx extension in browser url.
Your requested url could be like this http:localhost/EmailSendApp/login
so your request is sent to login method which is present in EmailSendApp controller
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 wants to redirect to my asp.net intranet website from current JSP (java) site
by putting a url in my current in java site hosted under tomcat
Any suggestion really appreciated.
You should put a line as follows on the page you want the redirection to happen. (Maybe index.jsp?)
<%
response.sendRedirect( "http://url.of.the.asp.page" ) ;
%>
All routes within my ASP.NET URL Routing web application are receiving a 404. However, the actual pages that exist are showing up correctly. I'm using IIS7. Any ideas?
All is good now. The main issue I had was that the HttpHandler for the UrlRouting was not added to the webServer section but rather the "old" handlers section.