How to publish mvc3 applications? - asp.net

I'm busy making a CMS using MVC3. I want to test the current build on the live server. Now, with a normal html website, you'd have a index.html or index.php and i think asp gives a default.aspx. But I don't have anything like that in my project. Can anyone tell me where to get a default page, or how to make one, I have no idea what the format/syntax would be...

This link might help:
http://msdn.microsoft.com/en-us/library/dd410407(v=vs.90).aspx
And a possible duplicate of this one:
Publish ASP.NET MVC Application : read configuration file permissions
and this
How to publish aspnet.mvc site?

The default page is defined by your routes and your views.
Look for something like /Home/Index.aspx which is what will be served up when going to www.domain.com
To do a simple publish use the Publish workflow by right-clicking your ASP.NET MVC project in Visual Studio and select Publish

Related

WebService on IIS with IIS-Manager

I just created a simple test WebService with Asp.net called
MyWebService.asmx
I can't access it from exteriour, cause Visual Studio don't allow this..
So I wanted to make a own IIS Webserver to host my Webservice, but
how do I add my "MyWebService.asmx" to the IIS with the IIS-Manager?
Hope someone can help me.. Google didnt help me a lot
You have to publish this WebService (right click on the project -> Publish) and host it using IIS like a regular Web Application.
Just create a new application, as you would do if you create a "real" ASP application
put, for completeness and to be sure the app is running a default.aspx into the root dir, which says something like "app is running!"
put the ASMX file into the directory (i think it will be place in the APP_CODE directory, but i'm not sure 100%)
config your webservice in the global.asax, without it nothing will happen (hint: also configure the help page for webservices, otherwise users accessing it will get the interface description in the browser)
A longer description of that can be found here: http://msdn.microsoft.com/en-us/library/8wbhsy70%28v=vs.80%29.aspx

ASP.NET ascx.cs via GET

Say I have this url:
http://site.example/dir/
In this folder I have these files: test.ascx.cs and test.ascx
Just to be clear, I am not a .NET developer.
From a security point of view - why can't I access http://site.example/dir/test.ascx.cs and how secure is it to keep those files there?
I assume IIS filters out request that query these kind of files, but can someone explain me this?
Thank you.
You just explained it yourself. IIS won't serve those files.
When you register ASP.NET with IIS (aspnet_regiis.exe) it will add common extensions and associate them with the ASP.NET handler. As far as the .cs extension is concerned it is filtered and not served by IIS. It is absolutely safe to have these files there, but I would recommend you to use an ASP.NET application project (in contrast to ASP.NET website) which is precompiled and you don't need to deploy source code files on your server.
(source: wewill.cn)

ASP.net MVC Routing problem

I have deployed my ASP.net MVC site to a shared hosting company. The problem is that now none of the pages except for the home page work. For example if I go to /Account/Register I get a page not found. However, if I go to /Account/Register/Index.aspx then it does work. I have tried modifying the routing to add in that index.aspx but everything I have tried fails.
Sounds like you need to either
1) have a wildcard mapping set up in IIS (don't know if thats an option)
2) or setup the routes to include the extension ("{controller}.mvc/{action}/{id}").
Either way have a look at this post by Phil Haack: ASP.NET MVC on IIS 6 Walkthrough

How to run/debug multiple web application projects with-in the same solution?

I have 2 web application projects. One is my asp.net MVC app and the other is for the admin related functions which is asp.net web forms Dynamic Data. My MVC app would be the main site, but I would want the webforms to work under an Admin folder of the MVC site.
While debugging the application, I would like the "/admin/Default.aspx" link on the MVC site to link to the default page within my Dynamic Data site. How do I accomplish this? I know I can test each project independently.
Within the visual studio project, you can right click on a folder and select "Convert to Web Application" which resolved my issue.
The easiest way would be to run them both in separate virtual directories and use Url Rewriting to push requests for the root to the public site. You can nest ASP.NET applications, but that generally requires quite a bit of fussing with the configuration file to dodge inheritance issues.
You could achieve this behavior via your IIS-Manager. Click on the Website, navigate to the folder you want to behave like a separate application and use right-mouse click and press "convert-to-application".

Add asp.net pages into sharepoint

How to add or open the asp.net pages from inside sharepoint?
I found many info on the web about that, but they all fail or they are not clear. I appreciate your help :)
Your question is not clear, but if you want to customize look'n'feel of SharePoint page you should use SharePoint Designer.
In case you want to create some additional functionality from scratch the easiest way is to create a custom web part and then add it to a SharePoint page.
I think you want to include an aspx page to call either using an AJAX include or to be able to use the MOSS Object Model without having to add references etc?
if so then the following steps are necessary:
navigate to 12\layouts\
create a folder for the asp.net files
put the inline code files in
From sharepoint you can add a page viewer web part and reference it with the following url _Layouts//Filename.aspx
This technique will only work with inline code, if you wish to compile your code then you would create the site as normal and then add an application folder within the virtual directory of that particular site for example my site is called intranet:
navigate to c:\inetpub\wwwroot\wss\intranet
add your asp.net folder to this as a sub folder
in inetmgr right click the folder and create an application for it (use the same app pool as the sharepoint site)
ensure ALL DLLs from the sharepoint site bin folder exist within the apps bin folder or it will throw an error.
However, I would only ever use these methods as proof of concept and would ultimately use web parts, custom features and workflows to carry out the same functions.

Resources