Web Forms :: Web.Routing Doesn't Work On Server On IIS Routing
Jul 20, 2010I tried everything I could find, but still does not work on IIS routing.
View 2 RepliesI tried everything I could find, but still does not work on IIS routing.
View 2 RepliesI'm using routing from System.Web.Routing without MVC in a standard ASP.Net Web Application Project application. This is mostly done to get neater urls in the portal we are developing (instead of ~/default.aspx?contentid=123 we have ~/{contentsubject}. The portal is not authorized and all info is in the url so in a caching scenario we can cache complete pages.
When I tried to enable output caching I noticed that no caching was done. It seems that the outputcache page directive is completely ignored. Is this true or am I missing something? Can this be fixed?
I made a small test app (I uploaded it to [URL] that just contains a page, Webform1.aspx, that uses a master page and a user control. All three output the current date and time.
When I request http//localhost/OutputcacheTest/Webform1.aspx the 10 second caching works as expected, i.e. the shown time only updates every 10 seconds.
The app also defines a wildcard route that catches all requests and returns the same Webform1.aspx as a handler. So when requesting http//localhost/OutputcacheTest/myroute the same page is executed but now the caching doesn't work, i.e. the current time is shown on every request.
Note: When using the built-in development web server both scenarios work, only IIS seems to have this problem.
Does anyone have a a solution or work around for how to enable output caching in this scenario?
I just testing the url routing. I plan to route url like that site.com/cat/{name}And I deal with it on cat.aspx
The problem is that I get 404(by firebug). The problem is that it doesnt even get to my asp.net error handler.
As it seems it stuck on IIS or doesnt even get to the IIS.
I'm on shared server so I dont have access to the IIS, so I cant get logs or configure things..
I am using URL routing in asp.net application (not MVC) . I have Admin folder in my aaplication which has admin related aspx pages with seperate web.config. I have seperate login form for admin users which is placed in admin folder itself. My issue is whenever I hit [URL] (which I want to go to login form for admin)- it tries to authenticate and goes to login url mentioned in web.config of root folder.
Note: Admin folder has anonymous access in root config file. Also I have set default document in config of Admin folder. I have added following line in global.asax so that routing doesnt work for files in admin folder;
routes.Add(new
Route("admin/{*resource}",
new
StopRoutingHandler()));
I am really confused what is the issue? What I am missing?
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?
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.
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)
When I try to use Routes in new ASp.Net WebaPplication using .Net framowork 3.5
Line 7: Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Line 8: ' Code that runs on application startup Line 9: RegisterRoutes(RouteTable.Routes)
I encounter Error: Warning: BC40056: Namespace or type specified in the Imports 'System.Web.Routing' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
Source Error: C:UsersTomAppDataLocalTempTemporary ASP.NET Fileswebsite2fec408f890149acApp_global.asax.2w_ytzx2.0.vb(26) : warning BC40056: Namespace or type specified in the Imports 'System.Web.Routing' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. Imports System.Web.Routing. I installed VS 2008 + sp1 on windows 7. and I am using Asp.net Developement server to Run Web Application.
In my web.config I have configured a SiteMapProvider with securityTrimmingEnabled="true" and on my main master page is an asp:Menu control bound to an asp:SiteMapDataSource. In addition I have configured restricted access to all pages in a subfolder "Admin" (using another web.config in this subfolder).
If I put a sitemapNode in Web.sitemap...
<siteMapNode url="~/Admin/Default.aspx" title="Administration" description="" >
... only users in role "Admin" will have the menu item related to that siteMapNode. So this is working fine and as intended.
Now I have defined a URL route in Global.asax to map the physical file to a new URL:
System.Web.Routing.RouteTable.Routes.MapPageRoute("AdminHomeRoute",
"Administration/Home", "~/Admin/Default.aspx");
But when I use this route-URL in the SiteMap file...
<siteMapNode url="Administration/Home" title="Administration" description="" >
... it seems that security trimming does not work: The menu item is visible for all users. (Access to the page is still restricted though, so selecting the menu item by non-Admin users does not navigate to the restricted page.)
Question: Is there any setting I've missed so far to make security trimming working with URL routing in ASP.NET 4.0 Web Forms? Did I do something wrong? Is there any work-around?
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?
I have Implemented routing in my web application. Iahve registerd the routes in global.asax file in application start event like the following: where my application containing a login page on the root
System.Web.Routing.RouteTable.Routes.Add("Login", new System.Web.Routing.Route("Login", new RouteHandler("~/Login.aspx")));
//RouteHandler class code
public class RouteHandler : IRouteHandler
{
public RouteHandler()
{
}
public RouteHandler(string virtualPath)
{
_virtualPath = virtualPath;
}
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
var display = BuildManager.CreateInstanceFromVirtualPath(
_virtualPath, typeof(Page)) as IDisplay;
return display;
}
string _virtualPath;
}
//IDisplay code
public interface IDisplay : IHttpHandler
{
}
And i have inherit the IDisplay on my login page.
No have host this application on the windows server 2003 on 80 port and map this to the sub domain like
[URL]
now i am browsing the url
[URL]
this giving me the page not found error on browser.
I am abel to browse the page if i use
[URL]
So wt is the main issues with this routing.
I have done all settion in web config for routing.
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?
is there any way to place the name of the server at the end of the url?For example, something like: http://HomePage/mysite.com instead of the usual http://mysite.com/HomePage
View 5 RepliesI my webform asp.net project, I use web api controller to access the server data.I use framework 4.5. On localhost everything works, but when I publish to server I get 404 for [URL] ..... This is the code in file global.asax
protected void Application_Start(object sender, EventArgs e) {
GlobalConfiguration.Configure(config =&gt; {
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
); }); }
On the server the framework 4.5 is installed. In IIS, in application pool, I've set the correct framework version. What are the server requirements? What should I install?
When I run my website on local server asp.net routing works very well, but when I deploy it on a remote server ( asp 4.0 integrated pipeline ) it always returns with 404 error.
My url route is very simple, a stored procedure gets image's id and then displays it.
Global.asax:
[Code]....
Default.cs:
[Code]....
I have implemented URL Routing in Asp.net 4.0 application, when i try to run it on windows server 2003 R2 server with IIS 6.0. the application works fine but without routing, whereas routing works fine on every other server.
View 1 Repliesi have implemented URL Routing in asp.net website using article (URL...) and it working file offline on my local system but when im trying to run online (from my hosting site) then it is showing error..
HTTP Error 404.0 - Not Found..
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I have web app written in .net 4.0 using url routing. It works fine in the development environment in VS 2010.But It's not working after publishing to iis7. on remote server i'm getting error HTTP Error 404.0 - Not FoundThe resource you are looking for has been removed, had its name changed, or is temporarily unavailable. I tried in virtual directory and it's not working.[URL]
View 1 RepliesThis is more of an ASP.NET Routing question than MVC, so I will gladly move this post to another forum if prompted!
I am using ASP.NET Routing without using MVC.
I am trying to implement the following URLs:
[URL]
[URL]
[URL]
Each page can have sub-pages:
[URL]
or even sub-sub-pages:
[URL]
I am currently implementing this as follows:
1) GLOBAL.ASAX
[Code]....
2) ROUTE HANDLER CLASSES
[Code]....
I am trying to implement Url routing in 4.0 by following example [URL]
Works fine..
Now the scenario is that i have gridview with object datasource which accepts "Name" as query string.
[Code]....
i tried this code. But i couldn't get the value in QueryString Field?? How to handle in this situation?? + How to implement (the link example in net 3.5)? because i don't "
[Code]....
" attribute in 3.5. i have few existing application in 3.5 so thought of implementing there too.
We have a shopping cart product. I am trying to implement ASP.Net 4 URL Routing. The problem I have is with image and other resource folders. I can resolve all the links that are defined within the pages and in the code behind. But, some of the links come from html text entered by users.
Using absolute path is not an option. There are some work arounds. But, I want to avoid those work-arounds, because we don't want to burden the users. Is there a way to achieve this through URL Routing?
E.g. The image path derived from the rewritten page: [URL]
Is there a way to achieve this without any patch work?
I have web app written in .net 4.0 using url routing. It works fine in the development environment in VS 2010.But It's not working after publishing to iis6. I keep having HTTP error 404. I tried Wildcard mapping with v4.0.0319aspnet_isapi.dll and it's not working.
View 1 RepliesIt is possible to use Asp.net Menu with Asp.net Route, the NavigatorUrl handle all the website address.
View 1 Repliesi want to avoid displaying page as [URL] It should show as [URL]....
View 1 Replieshow i would set up the routes table from a databse i.e can you do something like this i no i should load from a text file created from the save button of my cms page section but dont no how to do that.
rc.MapPageRoute (
"page",
"page/{Type}",
"~/cms.aspx");
// is their some way to load this into the global asx from a text file if so how?
"page/{Type}",
//URL with parameter
"~/cms.aspx");
//Web Form to handle