PDA

View Full Version : How do i do a url redirect?


validian
06-23-2010, 09:27 AM
I need to redirect my url from my main page, www.wsuswapmeet.com to www.wsuswapmeet.com/default.aspx. How do i go about doing this inside of visual studio?

I use visual studio 2010 with IIS 7 on windows 7 and am using asp.net 4 framework.

bruce
06-23-2010, 11:03 AM
default.aspx is already a default document, you don't really have to create any redirect. If you put wsuswapmeet.com in your browser, IIS will automatically load default.aspx if it exists.

edupa24
06-25-2010, 04:05 PM
Maybe you have a file named index.htm or something like that, and that's why the browser won't go to default.aspx.

If that's your case you should set Default.aspx to be the default document on IIS in your hosting's control panel.

But if you wish to make the redirect anyway, this code may help you:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim url As String
url = ("Default.aspx")
Response.Redirect(url)

End Sub