in Education by
We have redesigned the structure to a website which has several business units. Now I want to redirect (301) to the new page. IE: was www.example.com/abc now www.example.com/default.aspx?article=abc I have tried to use Global.asax to do this, and it works properly when I debug through it. if (Request.RawUrl.Contains("abc")) { Response.RedirectLocation = "/default.aspx?article=abc"; Response.StatusCode = 301; Response.StatusDescription = "Moved"; Response.End(); } So http://localhost:1234/example/abc redirects properly, but (where 1234 is the port for the debugging server) http://localhost/example/abc does not redirect, it gives me a 404. Any ideas? Additional info: If I go to http://localhost/example/abc/default.aspx then it redirects properly. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Well, if the port indicates you are using the built-in web server (the one that comes with VS), this probably works because that always routes requests through the ASP.NET framework. Requests ending with /abc will not automatically route through the ASP.NET framework because IIS may not "know" you want them to. You need to check your IIS settings to make sure such requests are routed to the aspnet_isapi.dll EDIT: To accomplish this, you need to add a wildcard mapping: In IIS Manager, expand the local computer, expand the Web Sites folder, right-click the Web site or virtual directory that you want, and then click Properties. Click the appropriate tab: Home Directory, Virtual Directory, or Directory. In the Application settings area, click Configuration, and then click the Mappings tab. To install a wildcard application map, do the following: On the Mappings tab, click Add or Insert. Type the path to the DLL in the Executable text box or click Browse to navigate to it (for example, the ASP.NET 2.0 dll is at c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll on my machine) For extension, use ".*" without quotes, of course Select which verbs you want to look for (GET,HEAD,POST,DEBUG are the usual for ASP.NET, you decide) Make sure "Script engine" or "Application engine" is selected Uncheck "Check that file exists" Click okay. I may be off on this, but if I am, hopefully someone will correct me. :)

Related questions

0 votes
    I'm using restful routing module for asp.net mvc and very happy with it. But I can't get one ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I am creating facebook comment box,it works fine with the static urls, but my url contains the query ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    I have a bunch of action methods inside my controller each with its own model binded as input parameter es ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I'm working on an extension (BHO) for Internet Explorer, and having trouble attaching a .NET delegate to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    C#6 Update In C#6 ?. is now a language feature: // C#1-5 propertyValue1 = myObject != null ? ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    C#6 Update In C#6 ?. is now a language feature: // C#1-5 propertyValue1 = myObject != null ? ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 20, 2022 in Education by JackTerrance
0 votes
    C#6 Update In C#6 ?. is now a language feature: // C#1-5 propertyValue1 = myObject != null ? ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 20, 2022 in Education by JackTerrance
0 votes
    C#6 Update In C#6 ?. is now a language feature: // C#1-5 propertyValue1 = myObject != null ? ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Explain Cookie-less Session in ASP.NET?...
asked Apr 8, 2021 in Education by JackTerrance
0 votes
    I am going through a ASP C# book and doing the tutorials. However I have encountered a problem. I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I am refactoring some CSS on a website. I have been working on, and noticed the absence of traditional ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    I am refactoring some CSS on a website. I have been working on, and noticed the absence of traditional ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    How do I implement a Copy menu item in a Windows application written in C#/.NET 2.0? I want to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    I've created a seperate assembly with a class that is intended to be published through wmi. Then I' ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
...