How to manage IIS from web page - asp.net

I have the need to add Host Headers to an existing web site in IIS. I want to be able to add this host header via a Web page, ASPX page. Also, I want to able to create a new web site from file.
Sample code?
How to do I manage security issues, what issues should I be concerned about?
How many host headers can a single web site have?
I am using the ASP.Net membership provider on the site.
Server is running IIS7 and Windows 2008 Server.

WMI is the best way to create website from your pages, I have used it and had referred http://blogs.msdn.com/ramesh_r/archive/2004/03/24/95109.aspx link.
This is really a cool link to understand/ learn WMI programming.
You can download WMI code generator from http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en

IIS 7 Has a managed code API which should allow you to do what you need.
Take a look at the API documentation from Microsoft, here: http://msdn.microsoft.com/en-gb/library/aa347649.aspx
This blog may be useful, too.

Related

Azure Subfolder Blog

I'm trying to figure how how/if it's possible to add a blog to a subfolder on an existing azure site.
BlogEngine seems like it would be a good choice since it's written in .net and from what I've read easy to setup as a standalone site on azure.
The problem I'm running into now is how can I setup my sub folder /blog as an application in azure. I know locally you can just pull up IIS and rightclick -> convert to application. But is there something I could put in the web.config or publish settings that would achieve the same thing?
Right now I'm getting an error message because /blog has it's own web.config file.
If there's an easier way or I'm thinking about this wrong let me know that too :-)
Thanks,
Andrew
EDIT
I contacted azure supported and they suggested I upgrade from a azure web site to a azure VM.
At this time there isn't a good way to run a full fledged blog engine side by side with an azure website without setting up a VM.
I ended up pulling from a google blogger blog using their data API. Not exactly what I was wanting to due but I couldn't take on the extra cost associated with a VM solution.

Sharepoint site as a subsite under a asp.net site

I have asp.net hosted at my domain which i access using a url like 'http://www.xyz.com. I have other web applications which are under the root web application in virtual directories which can be accessed using a url like 'http://www.xyz.com/subsite1 etc.
Now i want to have a sharepoint site as a subsite under my root website which i can access using a url like 'http://www.xyz.com/sharepointsite1.
I have installed sharepoint 2010 server.This installed a new website Sharepoint-80 and The central administration site. I have changed the Sharepoint-80 website setting to point to wwwwroot where my asp.net wesite and its subsite files are located. Now if i make a new site collection in my sharepoint site and it gets successfuly created. But when i browse it i get following error.
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.
My webserver is also a domain controller. How do i resolve this issue? And how do i achieve the main aim of having a sharepoint site as a subsite under my main website?
Thanx
I don't think that is possible, unless you are using different host headers or you can write an HttpModule which would be complex in my opinion. Although reverse is possible, You can have a sharepoint site at / and then an ASP.NET site at /subsite
The reason is an IIS SharePoint website is different from IIS ASP.NET website. IIS SharePoint Website registers an extra SPRequest module which fetches the data from SharePoint content database. When you request / , it will always try to pull this data from the SharePoint Content database.
In your case, where you have changed the SharePoint-80 website to point to wwwroot, you have essentially removed SPRequest module from the pipeline. That's the reason you get the error, because its not able to pull the content from the database.
You should do the other way around. Change main site to Sharepoint site, and let your other asp.net application/site to be subsite of sharepoint.
You cannot do that. Simply because you're trying to encapsulate a cloud-based system into an internal IIS folder structure.
You can not add Sharepoint online page in an iframe because of the same origin policy that most of the sites on internet adopted this days. This is mainly for security reasons to avoid from web attacks like Clickjacking and XSS.
You can not add Sharepoint online page in an iframe because of the same origin policy that most of the sites on internet adopted this days. This is mainly for security reasons to avoid from web attacks like Clickjacking and XSS.
If you want to display the content of the sharepoint online into different domain, than try to use provider hosted app in windows azure or develop a Napa sharepoint hosted app which can make cross domain requests in REST or ajax

ASP.NET Domain Controls

a client asked me today about having users be able to have their own domains within the web application.
example would be:
http://example.com/User/View.aspx?=60
would change into http://userpage.com/
I am not sure how to approach this, can anyone provide me few pointers?
Here is complete documentation from Microsoft on how to use multiple host headers. Essentially, you configure the web server (IIS) with multiple web sites, then within each website you configure the list of host headers that the site should respond to. This allows you to host multiple sites on the same server:
http://support.microsoft.com/kb/190008 (or similar articles for other versions, such as http://technet.microsoft.com/en-us/library/cc753195%28WS.10%29.aspx or http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e7a21b1f-ab13-47f2-8c61-b09cf14a7cb3.mspx?mfr=true)
Provided they have the domain and it is on a client's server, you can forward based on the id presented (60).
If http://userpage.webapp.com, you can use routing rules in ASP.NET 4.0 to handle this (some functionality in 3.5, I think, but 4.0 is better).

About using ASP.NET security and Membership in web applications

I have 3 questions about using ASP.NET security and Membership in web applications
Do people outside localhost have any means of accessing the ASP.NET security control panel?
What is the best way to edit security? Is it by opening the website through VS2010 and editing security, or there is another way or some control panel I can use?
I can't edit security while the folder is in wwwroot, so I have to cut it into desktop, edit its security the put it back in wwwroot folder. I don't think this is an acceptable way at all, any better ideas?
The Web Site Administration Tool (WSAT) is the default means to manage a ASP.NET site out of the box. If you want a deployable solution that can be integrated into your website you should look at the MyWSAT project on CodePlex. It provides all the features of WSAT.
1: No you cannot access the WSAT tool outside of localhost and it has to be used in conjunction with VS. (Note: I have seen people trying that but somehow it isn't easy.
2: You can use modules already created by others as one mentioned by Zack. Similar one is here. Or you can use Membership/Roles API to write your own pages do this work.
3: Not sure what is going on with your wwwroot issue. May be it could be some permission issue. Are you getting any error?

Deploying DotNetNuke and separate ASP.NET Application together - Possible Issues?

I am making this in a proactive attempt to head off any potential problems which could arise from this. The situation is that we are developing an ASP.NET application for a client which will handle the online ordering from their customers. This application is going to be using the same database that their current WinForms application uses (no real issue here).
At the same time we are developing a new front-end website for them using DotNetNuke. The DotNetNuke app will simply be linking to the ASP.NET application for the customers to submit their orders (no need for them to communicate back and forth, etc.)
The plan is to host both applications on the same box at the client location. What I am looking for are potential problems or setup tips which would prevent possible conflict between the two apps (web.config conflicts, etc.) Is there a problem with having both hosted on the same location, how should IIS be set up, etc.?
If there are any external resources also available which could address this, please feel free to link them as well.
Option 1: Make all the apps separate virtual directories off of the root website. Then have the root document redirect you to the proper subdirectory for the default application for that website(DNN).
Option 2: (DotNetNuke in root, other site in subdirectory) There will be many issues with web.config inheritance if the new application is not built with DotNetNuke, but you can get around these by blocking inheritance of the root web.config. Basically you add the following to your root web.config(DNN) file.
<location path="." inheritInChildApplications="false">
<system.web></system.web>
</location>
Option 3: As Scott said, create seperate sites with differnt subdomains and link them together. You can setup a redirect so whatever.com/order sends a user to order.whatever.com.
Just an FYI, if you use
inheritInChildApplications in DNN 4.7-4.9.2 (haven't verified 5.0) you will run into ScriptManager errors, previous versions of DNN don't have the problem.
We host a DNN site for our corporate site on the same Windows 2003 server with a bunch of other sites (.NET 2.0, SugarCRM, and even some WordPress instances with PHP extensions in IIS). These sites are 'separate' websites, and not subwebs of the default site. It's a real melting pot, and it works well. We did create some separate app pools for the PHP, .NET 2.0, and .NET 3.0/5 sites to ensure that they did not foul each other.

Resources