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
Similar Messages:
Jul 20, 2010
I tried everything I could find, but still does not work on IIS routing.
View 2 Replies
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
Apr 11, 2010
I thought I was getting the hang for asp.routing until I ran into this situation. I'm trying to use a data api that requires me to utilize OAuth. Well the redirect url after a user authenticates is:
/MyPage?token=thetoken
Does anyone know how to intercept that request and turn that url into a route that looks like this:
routes.Add("MyRoute",
new
Route("MyPage/{token}",
new
[code]...
View 2 Replies
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
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
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
Jan 28, 2012
I'm just trying to teach myself a bit of CSS and it's pretty straight forward but I am getting something odd.
I built a css file, tried out various rules, all good.
Now I edit the css file. Everything compiles ok but it's still using the rules as they were before I edited them. I've even removed some of them from the css file and they're still being used. I tried removing the reference to the css file and the rules all stop being used (as I'd expect) but when I add the reference back in and the old rules reappear but not the new ones.
I'm guessing there's some 'built' version of the css file and that's what's actually being used. But rebuilding the website isn't causing the built css to refresh itself so my edits aren't being picked up.
edit> forget it, I was hitting f5 not ctrl f5. Just a bit of cuture shock switching from desktop dev.
View 1 Replies
Jan 25, 2011
Trying to extract the timezone data from all the time zones using the timezoneinfo class but I have run into a problem. For those timezones that have Daylight savings times I am seeing all kinds of different numbers of adjustmentrules and I have no idea how to determien which rule I shoudl be using for a given timezone. Some have 1 rule, but I see timezones with multiple rules some as high as 11 rules. How do I know which rule I chould be usuing to get the correct DaylightTransitionSart and stop values?
View 2 Replies
May 23, 2010
i have images in left ,right,bottom of the page so i want to draw border like this , in vertical and horizontal,can you give example:
[code]....
View 1 Replies
Mar 17, 2011
Im using Intelligencia UrlRewriter for url rewriting. I have wrote a set of rules in the web.config file I have two sets pages, Static pages whose name is static but content is CMS based Dynamic pages (actually this is not simply a dynamic page its a category which have description and sub categories) Here both pages are being rewritten from the config file. For instance home page, about us page etc tis is being rewritten as
rewrite url="~/Home" to="~/Default.aspx"
The category page is being the same kind of url its being rewritten as
rewrite url="~/(.*)" to="~/GroupHome.aspx?Group=$1"
I have given the rules for the static pages first and then the category url but all the urls are being rewritten to grouphome, even if I have given the rule for home page, about us page etc before the category rule. I have tried even the ollowing still its directing to Group home,
<rewrite url="~/Home" to="~/Default.aspx"/>
<rewrite url="~/(.*)/" to="~/GroupHome.aspx?Group=$1"/>
<rewrite url="~/Home" to="~/Default.aspx"/>
How the rule can be rewritten to include both urls
View 1 Replies
Jan 19, 2010
I am considering using the following rules for a casual website. 8-20 chars long valid chars include letters, digits, and symbols case sensitive that's all. My question is, beside white space, is there other symbol that I should consider as "illegal"? Please keep in mind that it is a casual website so I don't need any password policy that is very restricted.
View 8 Replies
Oct 4, 2010
I'm trying to redirect any non-www prefixed traffic to the www prefixed domain. I'm using Umbraco as the CMS and have added the following code into the urlrewritingnet config file:
<add name="nonWWW"
virtualUrl="^(?!www.)(.*)$"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="[URL]"
ignoreCase="true" />
I'm getting a "is not a valid virtual path" error
View 1 Replies
Jan 4, 2011
I have 2 projects. A data project, which contains my database and my Entity Framework model. I have table called 'User', and then have a generated EF class for user. I am trying to add a partial class:
using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Text;
namespace Data
{
public partial class user
{
public bool isValid
{
get {
return (GetRuleViolations().Count()==0);
}
}
public IEnumerable<RuleViolation> GetRuleViolations()
{
yield break;
}
partialvoid OnValidate(ChangeAction action)
{
if (isValid)
throw new ApplicationException("Rule violation prevents saving");
}
}
public class RuleViolation
{
public string ErrorMessage { get; private set; }
public string PropertyName { get; private set; }
public RuleViolation (string errorMessage)
{
ErrorMessage = errorMessage;
}
public RuleViolation(string errorMessage, string propertyName)
{
ErrorMessage = errorMessage;
PropertyName = propertyName;
}
}
}
This is following the MVC 1.0 NerdDinner example. However, I am getting a design time error on the OnValidate method:
partial void OnValidate(ChangeAction action)
{
if (isValid)
throw new ApplicationException("Rule violation prevents saving");
}
No definining declaration found for implimenting declaration of partial method 'void OnValidate(ChangeAction action)' What am I doing wrong?
View 1 Replies
Apr 4, 2011
I sell products throgh my website. Recently we've been given a list of rules that need to be checked against each order, to make sure it's not fraudulent. So this list of rules/fraud indicators will change and grow so I want to make sure it's easily maintainable and really solid. I'm thinking I have an abstract class rule that each of the rules implements.
abstract class Rule
{
public string Message;
public bool Success;
public void CheckOrder(OrderItem currentOrder);
}
class FakeCreditCardNumberRule : Rule
{
public string Message = "Fake CC Number Rule";
public void CheckOrder(OrderItem currentOrder)
{
currentOrder.CreditCardNumber = "1234-5678-9012-3456";
Success = false;
}
}
class ReallyLargeOrderRule : Rule
{
public string Message = "Really Large Order Rule";
public void CheckOrder(OrderItem currentOrder)
{
currentOrder.ItemsOrder.Count > 100;
Success = false;
}
}
Then I'm thinking of having a class that accepts an Order object in it's costructor and checks though the list of rules. Something like:
class FraudChecker
{
List<Rule> rules;
public FraudChecker(OrderItem currentOrder)
{
foreach(var rule in rules)
{
rule.CheckOrder(currentOrder);
}
}
}
So I was trying to think of the best place/best way to populate the FraudChecker.Rules list and started thinking there might be some nice design pattern that does something like what I'm doing. Has anyone seen a design pattern I should use here? Or can anyone think of a good place to populate this list?
View 3 Replies
Mar 8, 2011
I have a product-page and a department-page. Both departments and products are picked from a database by their id (productid and deptid).
When I try to route like this, it seems that only the first rule is applied, Why? How can I solve this?
In global.asax:
[Code]....
With the above settings I can reach
http://mysite.com/myproduct.aspx but not
http://mysite.com/mydepartment.aspx.
If I switch so that the DeptList rule comes first "mydepartment.aspx" works but not "myproduct.aspx"....
View 3 Replies
Feb 24, 2011
I am getting problem in URL rewrite rules. I am used UrlRewritingNet.UrlRewriter Dll for Url rewriting in asp.net website.I used rules name as "Advanced"& Other rule name as DefaultRule that is used for any user profile page(ie. any user's profile page).When I entered username as "AdvancedMachinesTools". That Rules as below:-
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="Login" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
[code]...
View 2 Replies
Oct 9, 2013
I want to use wild card after first slash("/") in my url rewriting but i want other pages to redirect on particular page for e.g. if i use this
<rewrite url="~/(.+)" to="~/default.aspx" />
Then it will redirect all pages to to xyz.com/default.aspx
But i want this will fire last if i use some rule before that if will fire to that page not use this url rewriting like in MVC but i want it in through url rewriting e.g.
<rewrite url="~/submitform" to="~/submitform.aspx" />
<rewrite url="~/(.+)" to="~/default.aspx" />
in that case if user write xyz.com/submitform it will redirect to submitform.aspx else redirect to default.aspx.
View 1 Replies
Feb 18, 2010
Is it possible for an ASP.NET Validation Rule to belong to multiple groups? I'd like to validate the same control in different ways based on what mode the form is in using a single Validator. For the purposes of this question, the modes are Simple, which requires fewer fields, or Complex, which requires more fields. I know I can write CustomValidators (which I have done in the past), but I'd like a simpler solution.
So, I'd like to combine the following:
<asp:RequiredFieldValidator ValidationGroup="Simple" ControlToValidate="Name" />
<asp:RequiredFieldValidator ValidationGroup="Complex" ControlToValidate="Name" />
View 2 Replies
Oct 1, 2010
I am having some trouble when I use ASP .Net 4's URL Rewrite feature while Authorization rules configured.
Global.asax
[Code]....
{Root}Web.Config
[Code]....
{Root}RestrictedWeb.config
[Code]....
The problem I am facing is: When I try to visit [URL]- because of my dashboard rule in Global.asax, instead of being redirected to [URL] I am actually getting the content of [URL] when I try to visit [URL] I do get redirected to [URL] which is a good sign.
View 1 Replies
Jul 21, 2010
After pre-compiled a ASP.NET web site, I got many files with the names like
App_Web_accountbalance.aspx.dfa151d5.dll
Do you know the rule for the random chars (in bold) above? Can we fix the random chars? The reason to fix it is that if we modify AccountBalance.aspx file later and re-compile the web site, can we just replace App_Web_accountbalance.aspx.dfa151d5.dll.
View 1 Replies
Aug 3, 2010
How do i create access rule using code in web conf.
for example i have folder named secured and some rootdirectories under it e.g forum, account, members e.t.c so that anoynimous user shall be redirect to login page.
View 1 Replies
Jul 22, 2010
What I want to do it rewrite urls for a bunch of static pages in a locations folder such that
/london
maps to the physical file if it exist in the locations folder eg.
/locations/london.aspx
Is this possible with url rewrite. I can't get the rule to work.
<rule name="Rewrite Locations">
<match url="^([_0-9a-z-]+)/*" />
<conditions>
<add input="/locations/{REQUEST_FILENAME}.aspx" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="/locations/{R:1}.aspx" />
</rule>
View 1 Replies
Jul 14, 2010
I have create following rule on my local server to check canonical url
<rewrite>
<rules>
<rule name="Enforce canonical hostname" stopProcessing="true">
<match url="(.*)"/>
[Code]....
Its working but i have default.aspx page on which i have taken one link button and written event like this
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Response.Write("Testing Canonical Issue")
End Sub
When i click that linkbutton nothing happens only page get refreshed.
Actually i dont want to display default.aspx page along with my website thats why i have written second rule.
I want domain name with no default.aspx page
if some body writes like this www.abc.com/default.aspx then it must be 301 redirect to www.abc.com
View 1 Replies
Sep 27, 2010
I was wondering it is possible to turn off the canonical hostname URL Rewrite rule from the URL Rewrite 2.0 IIS 7.5 Module.
I'm locally developing on a IIS 7.5. The setting of this URL Rewrite rule is set in the web.config.
This is how I deploy: I'm using Webdeploy to publish my web application. The new web.config transforms, which was introduced with VS 2010, is no option for me, because it is bugged:
[URL] and will not be fixed until the release of VS2010 SP1. I'm also not using web deployment projects anymore, because Webdeploy does not seem working with web deployment projects. As a result, I manually switch on the rewrite rule in the web.config before deploying.
If I now want to locally debug something, I manually need to turn off the rule.
Is there a solution like this pseudo-code?
if(Properties.Settings.TurnOffCanonicalHostNameWithLocalHost)
{
URLRewriteModule["CanonicalHostName"].Enabled = false;
}
View 1 Replies