I am working on hosting a website developed using asp.net to AWS. I have successfully published it to EC2 instance. I want to setup Index.aspx page as default page so that if someone open the URL it should automatically load index.aspx page e.g. typing www.domain.com opens up index.aspx page. I have tried all the options but somehow its not working for me. Any suggestions will be highly appreciated.
For IIS Web Server you should look at the web.config file.
Make sure you have <defaultDocument enabled="true">
The default files in recent IIS version are (in order)
index.htm
index.html
default.asp
default.aspx
index.asp
index.aspx
index.cfm
index.php
default.htm
If you don't enable the default list, you would need to make sure your index file is added to the list
<defaultDocument>
<files>
<add value="index.aspx"/>
<add value="..."/>
</files>
</defaultDocument>
Related
I have an ASP.Net application. The application is working when the url is http://locahost/device.aspx but not working when the given url is just http://locahost. It is throwing an IIS exception and the IIS image is displayed when http://locahost is given
IIS image displayed
If you are using IIS, you need to set the default page in your IIS server. You can check the steps online as it varies from version to version.
Another way thorough web.config, you need to add following tag in your web.config file
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="device.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Because you don't have a default.aspx page.
IIS searchs the Default.aspx if you don't define in the url the page that you want to display . If Default.aspx doesn't exist, it can't decide which page to display.
If you don't have a Default aspx, you should add your device.aspx in the iis manager to your site like on the image.
First, you should open the iis manager (you can type Windows + R to execute the command inetmgr in order to open the iis manager).
Than you expand the server and Default Web site and choose your application.
Double click on the Default Documents and add a new default documents like on the image.
If you want to refer the default web site to your application in order to use only http://localhost url, you can configure your iis like on the second image
I'm developing web service on Visual Studio development server. Browser starts at project root directory and shows files list. I always must select required asmx file to run some tests. Is it possible to ask debugger to show webpage on required asmx address instead of directory list?
You can set default document on web.config file for specific asmx file name.
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="TestService.asmx" />
</files>
</defaultDocument>
</system.webServer>
Visual Studio runs the page that was currently in focus in your designer.
If you set this page, Visual web Developer will start your web site with the Set Page and not the current page in designer.
You can do this by right-click on the page and selecting Set As Start Page option from the context menu.
I've hosted my Visual Studio project on somee.com and I'm having trouble setting it up there. I've uploaded all the files of the Visual Studio Project (data layer, lib, model layer, sln file, suo file).
I found out that in order to assign the default page you need to write that in the web config file. I've written the following lines in my web config file.
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear />
<add value="www.omsshutter.somee.com/www.omsshutter.somee.com/Shutter 2000 Halloween/login.aspx"/>
</files>
</defaultDocument>
</system.webServer>
The login.aspx page which I want to be the default page does not come up. It's in the "Shutter 2000 Halloween" folder. How can get this working?
You need to use relative path to file instead of full HTTP path. i.e. Use following line
<add value="Shutter 2000 Halloween/login.aspx"/>
instead of
<add value="www.omsshutter.somee.com/www.omsshutter.somee.com/Shutter 2000 Halloween/login.aspx"/>
Method 1
You can always check the user state secured/user-visible master page.
If user isnt logged in from master page load simple redirect to login page (having public master page) using.
Server.Transfer("~/login.aspx");
Method 2
In your Global.asax.cs file, write the following:
public void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes routeCollection;
routeCollection.MapPageRoute("DefaultRoute", string.Empty, "~/YourDesiredSubFolder/YourDesiredDocument.aspx");
}
Explanation:
Application_Start code is guaranteed to run once and only once on the
application start.
The first line of code, gets a collection of the
URL routes for your application.
The second line of code, defines a
new route pointing to your inner page in the subfolder that you wish.
The second argument is empty to indicate that this route is used when
there's no specific page is requested and there's no Default document
existing.
I've got a NopCommerce site (ASP.NET MVC) and I'm trying to add a Wordpress blog as a subfolder of the main site.
The installation of Wordpress was fine, all config files have been created and the blog works fine if you browser through it.
However, I now want to setup pretty permalinks by using the name of the post.
Normally when you setup permalinks, it generates either a .htaccess file for Apache or a web.config for Windows IIS7 Url Rewrites.
When I try and save the permalink settings, it sits there trying to load and eventually times out.
I'm guessing that because ASP.NET MVC uses Routes, the Wordpress site doesn't know what to setup.
Can anyone offer me guidance on how I can get the permalinks setup? Do I need to setup a Route on my MVC site perhaps?
In the end I copied a web.config file from one of my existing blogs that is on a standard C# website.
Normally Wordpress generates the web.config file itself. I can only assume that Wordpress hasn't been setup yet to handle installation on .NET MVC websites.
Creating a web.config file, in the root on the Wordpress blog files, containing the following code should get it working:
<?xml version="1.0" encoding="UTF-8">
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear/>
<add value="index.php"/>
</files>
</defaultDocument>
<rewrite>
<rule name="wordpress" patternSyntax="wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule>
</rewrite>
</system.webServer>
</configuration>
If you install WordPress on IIS you will notice your friendly URLs do not work. This is because WordPress wants to use an apache add-on called “mod_rewrite.” The quick rundown of that this does is it will take your friendly browser URL and actually change them to index.php on the back end. One problem with this method is that IIS does not load apache mods. Here is an easy and free way around this:
On your IIS Server download and install ISAPI_Rewrite Lite. This filter does the job of mod_rewrite for IIS. When downloading make sure to use the free Lite version. This Lite version does not limit the product very much and will be perfectly fine (and free) for our wordpress blog. Just install Rewrite Lite to the default locations for this tutorial.
Next add the ISAPI filter to your IIS Site.
You will find this setting by right clicking yourIIS site -> properties -> ISAPI filters tab -> Add … Name the filter whatever you wish and your path to your executable should be:
C:\Program Files\Helicon\ISAPI_Rewrite3\ISAPI_Rewrite.dll
Click OK on both windows to save your settings.
Next navigate to C:\Program Files\Helicon\ISAPI_Rewrite3
Here we will edit httpd.conf (Note: This is the difference between the pay version and the Lite version. In the pay version you will need to edit the .htaccess file on your web folders root)
Open the httpd.conf file in wordpad and paste in these lines:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?p=$1 [NC,L]
Save and exit this file.
To complete your IIS changes, Go to start, run and run the command: iisreset /restart
Now lets change your WordPress settings. Navigate to http://yourblog/wp-admin
Navigate to the left side menu bar -> settings -> Permalinks
Now you get to choose how you want your posts to look. I choose a custom setting and just: /%postname% This is how you see this blog working today.
Click “Save Changes” and you should see your new friendly URLs!
I have a web service built for SharePoint 2007 that I am trying to port to SharePoint 2010. This web service is dependent on session state to function properly, but so far, I have been enable to get session state to work at all in SharePoint 2010. This web service runs as its own web application under t
he /_vti_bin virtual directory. I have tried all of the following with no luck:
Ensured the "State Service" service application is running.
Added the System.Web.SessionState.SessionStateModule http module to my application's web.config file.
Added the System.Web.SessionState.SessionStateModule http module to my SharePoint root web.config file.
Added <pages enableSessionState="true" /> to my application's web.config file.
Added <pages enableSessionState="true" /> to my root web.config file.
Additional Environment info:
Visual Studio 2008 - SP1
.NET 3.5 - SP1
SharePoint 2010 - RC
Windows Server 2008 R2
ASMX web service (not WCF)
Had anyone had any luck getting a web application or web service to use session state in SharePoint 2010 yet?
Thanks!
Steve
You've already answered this yourself somewhere else on the interweb. :)
<httpModules>
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
</httpModules>
THEN, you must go into your web application and add the same session state module to the IIS7 managed pipeline.
Open IIS 7 manager, and find your web application.
Double click "Modules" in the IIS section.
Click "Add Managed Module..." on the right hand pane.
In the Add Managed Module dialog, enter "SessionState" or something like that for the name, and choose the following item from the dropdown:
System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
After that, session state should be enabled for your web app/web service!
You may need to turn on the Session State Service. Use the PowerShell cmdlet Enable-SPSessionStateService. This will create a Session State database and start the service in SharePoint 2010.
Reference information:
http://technet.microsoft.com/en-us/library/ee890113.aspx
The best link I have seen on this is here: http://blogs.msdn.com/b/markarend/archive/2010/05/27/using-session-state-in-sharepoint-2010.aspx
Joshua's solution helped point me in the right direction but I had to make some variations for my scenario - an ASP.NET 3.5 Web Site deployed to the _layouts folder.
Here are the steps that worked for me:
changed the <pages> tag in the web.config for the Web Site to <pages enableSessionState="true" />
Added the System.Web.SessionState.SessionStateModule module at the Sharepoint website level (not the entire IIS level - that'll break the Central Administration, I tried :( ) as per #Joshua's solution. If you're deploying a Web Application instead of a Web Site, you'll want to add it at your Web Application level.
Adding the SessionState HTTPModule below to the web.config didn't seem to have an effect for me, probably because I was riding on Sharepoint's web.config as my project was a Web Site and not a Web Application. Not too clear on this issue.
<httpModules>
<add name = "Session" type = "System.Web.SessionState.SessionStateModule" />
</httpModules>
Do like below:
<modules runAllManagedModulesForAllrequests>
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
</modules>
modules is an xml tag. I don't know why, this post is not taking xml tags..
Thanks
Carol