start Page functionality does not work - asp.net

I have an asp.net website,
and i have set 1 page "search.aspx" as start page,
and when i type url like this:" http://localhost/websitename/subfolder/Search.aspx"
it opens properly.
but i want it to open when i type : " http://localhost/websitename/" like this only,
and i have set the "search.aspx" as start page.
Can anyone please help,
i tried changing property pages also.
but it did not help.

Start Page in Visual Studio just refers to the page which will be opened when you Run your solution.
When running localhost, the "Default Page" for ASP.NET is always Default.aspx (unless you do a lot of workarounds).
In IIS you have control over this however, by setting "Default Documents".

You need to set the start page in IIS. Here is a tutorial
http://www.ehow.com/how_4532283_set-start-page-microsoft-iis.html

There are two points to consider here.
Firstly, you need to look in IIS and see what "Default Documents" you have set up for that web application. If "search.aspx" is not listed then that page won't be served as a default page for that folder. If you add "search.aspx" as a default document then your page will show if you navigate to websitename/subfolder/
Secondly, are you providing a way to traverse to the subfolder? IIS will be looking for the default document in the ..websitename/ folder. If the default document was "default.aspx" you need to add some sort of redirect to the subfolder.
Alternatively, set the subfolder as the root folder of your website (unless you need to go up one level).

You have to specify a default document for the page in IIS, or make the default page redirect to the search page, alternatively use routing.
Here is how you set default document in IIS6.
Since you want a page in a subfolder to be the default your easiest path is either a redirect or routing.

you can try doing this.
take a blank index.htm page and add meta tag for redirecting to your starting page:
<head>
<title></title>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://localhost/websitename/subfolder/Search.aspx">
</head>
Make default page(index.htm) in IIS for the website.
IIS7
IIS 6.0
use following setting in web.config:
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="index.htm" />
</files>
</defaultDocument>
</system.webServer>
reference:Default Document

Related

Redirect ASP pages to a new URL

Our old website was built using ASP and now we are using Wordpress (IIS) utilizing a sub-directory. All of the old ASP files are still in the root directory and I'd like to redirect all of these file extensions to our new Wordpress site because the old ASP files are causing 404 errors.
I'm having a real difficult time figuring out what to put in my web.config file so all the old ASP pages are redirected to our new home page.
Thanks
The best option is to use the URL Rewriting extension for IIS ( http://www.iis.net/downloads/microsoft/url-rewrite ) which can also perform regex-based redirections. Create a new rule that matches (.+)\.asp and redirects as appropriate.
I don't know if you just want to do a 'dumb' redirect from all .asp-URIs to your WordPress root, or if you want to intelligently redirect users from the old .asp pages to their new WordPress equivalents (this is a good idea as it means search engine results and previous links won't be broken, I'm sure you can imagine how frustrating it is to follow a link that doesn't go where the user expects).
Thanks everyone for your suggestions, but because I don't have access to the server, my only solution was to work with the web.config file. I simply added the following code and everything now works:
<directoryBrowse enabled="true" />
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
<add wildcard="*.asp" destination="/" />
</httpRedirect>

url mapping from html to aspx

I want to redirect some html page to aspx.
I try this in my web.config like below:
 <urlMappings enabled="true">
  <add url="~/report.html" mappedUrl="~/page.aspx?id=2"/>
<add url="~/product.html" mappedUrl="~/products.aspx?type=all"/>
  </urlMappings>
but it doesn't work, is I thinking got something wrong?
Is there any better idea except to create html files and set the meta refresh?
Thx.
By default IIS won't run .html pages through the aspnet engine. You'll have to configure the server to pass all requests through the aspnet engine as mentioned in this article: http://www.codeproject.com/Articles/2538/URL-Rewriting-with-ASP-NET in the Finally section.

IIS doesn't show my web page

I had some problems to show my webPage using IIS 8.0.
Now I get no erros when I open my page through IIS but now it only appears:
Local host - /
Date Time Folder's Name
Date Time Folder's Name
Date Time Folder's Name
What Should I do to show my WebPage?
I already checked the ASP.NET option on Active or Desactive Windows Featuresof control panel.
If you want to use a custom page name for your default page like "mypages.aspx" as in your case, you can configure to do so in your web.config
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="~/mypages.aspx"/>
</files>
</defaultDocument>
</system.webServer>
You can do the same in IIS going to DefaultDocument section under your deployed site settings in IIS. Check this and this so question as your are using IIS8 for more info.
Did you check to make sure you have a default webpage? E.g. index.html, index.asp, default.html or default.asp? The names are based on the settings of the site of course.
Make a basic html page:
<html>
<body>
Hello world.
</body>
</html>
Then put it in the directory IIS is looking for, for the website. You'll want to make sure you setup your DNS to reflect the domain you are trying to host, and then change your local network settings to use your computer's IP before any other DNS. This will allow you to see the website.

How do I set the default page of my application in IIS7?

I deployed my web application to IIS7 and everything works just fine. However, instead of typing the url of my true starting page, I want it to automatically go to www.xxxxxx.com/views/root/default.aspx.
How do I do this?
Just go to web.config file and add following
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Path of your Page" />
</files>
</defaultDocument>
</system.webServer>
On IIS Manager select your page in the Sites tree.
Double click on configuration editor.
Select system.webServer/defaultDocument in the drop-down.
Change the "default.aspx" to the name of your document.
Karan has posted the answer but that didn't work for me. So, I am posting what worked for me. If that didn't work then user can try this
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="myFile.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
On IIS Manager--> Http view--> double click on Default and write the name of your desired startup page, Thats it
For those who are newbie like me, Open IIS, expand your server name, choose sites, click on your website. On new install, it is Default web site. Click it. On the right side you have Default document option. Double click it. You will see default.htm, default.asp, index.htm etc.. to the extreme right click add. Enter the full name of your file(including extension) that you want to set it as default. click ok. Open cmd prompt as admin and reset iis. Remove all files from c:\inetpub\wwwroot folder like iisstart.html, index.html etc.
Note: This will automatically create web.config file in your c:\inetpub\wwwroot folder. I didnt have any web.config files in my inetpub or wwwroot folders. This automatically created one for me.
Next time when you enter http(s)://servername, it opens the default page you set.
If you want to do something like,User enter url "www.xxxxxx.com/views/root/" & default page is displayed then I guess you have to set the default/home/welcome page attribute in IIS. But if user just enters "www.xxxxxx.com" and you still want to forward to your url, then you have write a line of code in the default page to forward to your desired url. This default page should be in root directory of your application, so www.xxxxx.com will load www.xxxx.com/index.html which will redirect the user to your desired url
I was trying do the same of making a particular file my default page, instead of directory structure.
So in IIS server I had to go to Default Document, add the page that I want to make as default and at the same time, go to the Web.config file and update the defaultDocument header with "enabled=true". This worked for me. Hopefully it helps.

Extensionless Page Requests

I have a customer of ours that sent out a publication referring to my site but they used the wrong address...they did not provide a page name...it looks like this:
mywebsite.org/Resources/toolkits/bridging
when it should have been
mywebsite.org/Resources/toolkits/bridging/default.aspx
Is there a way to tell ASP.NET to default to this default.aspx when it sees this kind of request or even better, have IIS 7 handle this easily?
This site is live so I would like to avoid having to introduce code if possible.
As per other suggestions, this should be done in the IIS configuration for your website using the IIS Admin tool.
There is however, another alternative - you can add a section in the web.config of your actual ASP.NET application, allowing you to override the IIS configuration right from your application:
<system.webServer>
<defaultDocument>
<files>
<clear />
<!-- Specify each of your files by order of preference here -->
<add value="Default.aspx" />
<add value="Index.aspx" />
<add value="MyOtherPage.aspx" />
</files>
</defaultDocument>
</system.webServer>
The caveat to this though is it may be a little obtuse when the IIS administrator can't figure out why the server configuration isn't working the way he's got it configured. It's not always right to do something just because you can.
Finally, just in case you don't have access to the IIS server or your IIS administrator has reasons for not adding Default.aspx to the default document list in the IIS configuration and for whatever reason, you don't wish to override the IIS configuration in your web.config file, then the quickest and simplest way is to simply create a file called default.asp in that directory containing:
<% Response.Redirect("default.aspx") %>
Default.asp is in the default document list on IIS. The code will automatically redirect the call to the correct page. The downside to this approach though is that there's a performance hit - every time someone calls default.asp - directly or otherwise, the redirect needs to happen which isn't free.
In the Documents tab of the web site properties in IIS you can specify default documents. If you are using .Net2.0 or later on that machine then Default.aspx should already be set....
Default.aspx is not, oddly enough, set as the default document in an IIS installation; In IIS 7, the setting is under "HTTP Features", called "Default Document". Add default.aspx to that list and you should be OK.
If not, you'll need to add a 404 handler that redirects when it sees that URL.

Resources