Redirecting to a page using IIS6 - asp.net

I have a site .net 2.0 and I redirected users to a
login page when the hit the site. (I think the default.aspx page)
But i cant remember how i did it.
I am now wanting upgrade to asp.net mvc app
but the redirect is still there to a nonexistent page.
Any ideas how to find the redirect?
Malcolm

Use WireShark Network Analyzer or Fiddler to find out what type of Redirect you have and the location that's redirecting.
You can then use IIS management console to see if there are any redirects in the site or virtual directory properties.
And finally check the source of the script that handles the request for Response.Redirect() or Server.Transfer().

Related

Asp.Net ViewState behind CDN

I have an Asp.Net app running under IIS with two backend servers with Loadbalancing + machinekey configured. Once I've activated a CDN (Varnish with caching disabled), I'm redirected to login page every time I navigate between pages.
I believe that the postbacks are cached somewhere and the app logs don't help.
I've seen similar answers like here, but none of them suggested a solution.
Any idea how to track this down without changing the App config?
On the browser, this is what I see :
https://example.com/
302 redirection to https://example.com/login.aspx?ReturnUrl=%2f
successful login redirects to https://example.com/accueil.aspx with some errors (see attached)
selcting https://example.com/pages/module.aspx?PAGEID=-00000001 reurn a 302 redirection to loginn page https://example.com/login.aspx?ReturnUrl=%2fpages%2faccueil.aspx%3fMSG%3dIdentification+obligatoire
enter image description here

Akamai has issue with ASPX post backs

I'm using Akamai Edge Server to serve up all my web content except for html and aspx pages. The issue I am having is with a language switcher that does a post back to the same page and then based on the language does a response.redirect to the same page in the other language folder.
The steps that happen are:
go to page /en/default.aspx
select a different language such as fr.
The aspx code on that page calls a header user control which will then redirect to the proper language page
It fails on the postback to the control and I get an access denied on /en/default.aspx which is an akamai page not on my webserver.
If I access my dotnet server directly you'll see that the page will do a postback to itself /en/default.aspx then a response.redirect to /fr/default.aspx
Ok I figured it out that akamai edge server doesn't allow posts by default and you have to enable it. Im new to using akamai in this way didn't think it would deny such a common thing.

Url rewriting with asp.net. is there a configuration needed?

I'm trying to enable rewrited urls in my project.
it's very good described in this post: urlrewriting by scottgu
It works very well when im running it on localhost, but as soon as i upload it to my host (.net 3.5), it doesn't work! i always get redirected to a 404 page!
Is there a configuration needed to enable this?
as scottgu says no, but i don't find out why it's not working...
thanks
// UPDATE 2.09.2010
Is there actually a way to enable routing or rewriting without having iis7 or the ability to install a modul like ISAPI Rewrite on the server?
Looks like i got a bad asp.net host...
In your localhost environment you are probably running the website on your ASP.NET Development server. That server is set up to capture all request (* . *) and run them through the ASP.NET pipeline.
II6 on the other hand, is configured to only send some requests ( ie *.aspx, *.asmx, *.ashx) through the ASP.NET pipeline. So if you are trying to catch a request for an url like "/my/fine/url" that will never be passed to the ASP.NET handler, and thus not rewritten.
You can change this configuration in the Application configuration for the website:
Open IIS Manager and right-click on the website, choose Properties
On the tab "Home Directory", click "Configuration..." button.
Click "Insert..." button to insert a Wildcard application map.
In "Executable:" insert path to aspnet_isapi.dll, in my case C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll (note: this path may differ on you server).
Remember to uncheck "Verify that file Exists"
Click OK!
And so! All your requests should now be directed to the ASP.NET handler and hence caught in your URL rewriter, regardless of extension.
But I must admit that I'm a bit unsure as to how this will affect performance on you site, routing all requests for static files, css, images etc through the ASP.NET handler. Maybe someone else out there has something to say about that.
/Dennis :-)
There are two ways to get the extensionless routes in IIS6:
a) ISAPI rewrite or other ISAPI url rewriter
b) Use a wildcard mapping to aspnet_isapi.dll
See this blog post for detailed instructions.
Here is example how to use new System.Web.Routing within ASP.NET WebForms.
http://deepumi.wordpress.com/2010/02/27/url-routing-in-asp-net-web-forms/

URL Redirects in ASP.NET

Ok, wierd problem I cant figure out. Hopefully someone where can. I have inherited a site that was developed with a very over-architected Content Management System. I am having problems now with the redirection functionality built into it.
This is on a dedicated Windows 2003 server running ASP.NET 3.5 sp 1. The redirects are stored in the database, and I have confirmed that the correct redirect is in place in the database. Finally, the file extension .html has been mapped in IIS to the ASP.NET ISAPI. And there is an HttpHandler created to redirect the .html requests. The default documents on the server, in order, are:
default.aspx
index.aspx
default.asp
index.asp
default.html
index.html
for this example, we have two redirects both pointing to the same content page. /example and /example.html
when requesting /example.html it correctly finds the appropriate redirect in the database and does its magic. Bueno. When requesting /example it gives a 404 page. Its not even the asp.net yellowish 404 generic error page. Its the standard vanilla IIS 404 response so it appears that asp.net is not intercepting these requests.
Let me know if any other information is requested and I will try to provide what I can. Thanks in advance for all the great recommendation I am sure will come from the community.
You should be able to map a wildcard extension to go through the ASP.Net ISAPI DLL is the solution.
Installing Wildcard Application Mappings (IIS 6.0) may also be useful.
Without rewriting the CMS, you can put a physical file in a new directory "/example". This will trigger ASP.NET to intercept the request, and hopefully load your page.
If you want to really hack it up you can change the IIS 404 page to be a .NET page in your application that can handle the original request and redirect to the page you really want.
Yes this is correct because /example is not pointing to any file, it is pointing to directory in the web server. Check that Default.aspx/ default.html or any other atleast one of them exists in your app.
If you are using ASP.Net MVC for REST then check your actions are properly written.

Custom URL Extensions/Routing Without IIS Access

I have a need to use extensionless URLs. I do not have access to IIS (6.0) so I cannot map requests to ASP.NET and handle with a HttpHandler/HttpModule. However, I can set a custom 404 page via web host control panel.
My current plan is to perform necessary logic in the custom 404 page, but it "feels wrong". Are there any recommendations that I am missing?
Edited: Added "Without IIS Access" to the title since someone thought this was a repeat question.
Without access to IIS, that would be your only option.
The 404 page really is your only option if you can't map the requests. I've seen several blog packages that do this to enable magic URLs like .../archive/YYYY/MM/DD and such - there's no such page, so it hits the 404 page and the 404 page does the redirection.

Resources