Banner Ad

Wednesday, September 9, 2015

How to publish ASP.Net Web application using Visual Studio 2015

By Francis   Posted at   6:52 PM   Visual Studio No comments

                             In this post, we are going to see a step by step procedure using the custom profile option. In other words, this post is going to explain how to publish the website in local file system.

                       The main purpose of publish dialog is provide an simplified way to take the file list which need to be publish on your website. In this article I’m going to explain how to publish a MVC web application using the “publish” dialog provided in VS 2015.

 Step 1 : Open Publish Dialog

                    You can open the publish dialog by “Right Click” on the project then select “Publish” on the floating menu.

PublishCommand

 

Step 2: Create Profile

                       As a first step, you should create a profile before publishing. This is just one kind of grouping, say for example you can create multiple profile one for Azure and one for local. So when next time you open this dialog you can see the profiles and select from them.

PublishDialog

I have selected “Custom” as a “Publish Target” and gave profile name as “LocalPublish”.

PublishProfileDialog

Step 3: Select the Connection

In this step, we need to tell where our published files are going to be. You can publish the files directly on your server also by selecting “Web Deploy” publish method or you can use FTP too.

PublishOptions

Since I’m going to publish files in local file system so I selected “File System”.

PublishInLocal

Step 4: Select Configuration and other settings

In this step, you can choose “Configuration” mode and other settings like delete files before publishing in the specific folder, precompile etc.

PublishMode

 

Step 5: Preview & Publish

You are about to complete your publishing. Click publish to start the publishing.

PublishPreview

In the output window you can see the result of the publish.

OutputWindowAck

 

Hope this post is useful who are all using the “Publish” option in Visual Studio 2015.

Happy Coding!!

Monday, September 7, 2015

How to Hosting Asp.net MVC Web Application in Local Machine?

By Francis   Posted at   2:32 PM   IIS No comments

                     In this post I’m going to discuss about how to host an ASP.Net MVC Application in your  local machine. Most of the steps to deploy a web form application and MVC applications are equivalent.

Prerequisite:

           In order to explain the steps, I assume you have a complete ASP.Net MVC Application that is ready to build with out any error.

Step 1:

Publish you MVC application in a local file path, using publish option in Visual Studio.

publishOptionInVS

For this example, I have published my application in the below path like : C:\MVCDemo

ASPNETPublishedFiles

Step 2:

Create a Virtual directory in IIS and mapped the above published file path to it.

MVCAppVirtualDirectory

If you have any doubts in creating virtual directory refer my below blog posts:

Create virtual directory on IIS using Visual Studio.

Create Virtual directory on IIS

Step 3:

You are almost done! The only thing pending is you need to browse the website, that just published. This is where most of the ASP.Net developer (especially who is a newbie to ASP.Net MVC), what they were doing : Expand the Virtual directory –> Views –> Switch to content view –> select the cshtml file –> right click on it and click “Browse”, which throws 404 Error in browser.

BrowseMVCFile

404Error

 

The above issue is common to all ASP.Net developers, who are all comes with ASP.Net  WebForm background. In order to browse the  mvc application, you need to mention the path in the form like “http://localhost/YourControllerName/YourActionMethod", which is the url routing pattern specified by default.

 

ASPNetApplication

 

Hope this helps!

Thursday, September 3, 2015

Daily Interview Questions #15 : What is the difference between the C# keywords ‘ref’ and ‘out’?

By Francis   Posted at   5:26 AM   C# Interview Questions No comments

ref

out

Parameters passed with the prefix “ref”. By using “ref” C# implements the concept called “Call by reference”. Parameters passed with the prefix “out”.
An argument passed by ref must be assigned with a value before the call. ‘out’ parameter must assigned with some value prior to the termination of the function.

Tuesday, August 18, 2015

How to Send SMS From ASP.Net Web Application?

By Francis   Posted at   7:14 PM   SMS Gateways 20 comments
Disclaimer:
            In this article I have used a Third party SMS Gateway service provider, which is I have personally used and experienced.
Introduction:
                    In my previous article I explained SMS Gateways and the various schemes available for them. This article explains how to integrate those SMS gateways into an ASP.Net web application.
What a "SMS Gateway" is?
                   A SMS Gateway allows a computer to send or receive SMS to or from a telecommunications network. This Wikipedia URL provides more detail.
Some “facts” about SMS Gateways
                  When I did some experimentation and Googling of SMS gateways some of the tutorials suggested use of “free” SMS gateways. But nothing worked for me. Latter I understood that “Nothing comes free”. Also most people asked the same question: “Is there any free SMS service is available to send SMS from my website?”. In my experience the answer is no. So my point here is, don’t waste your time searching for the free API. Instead, find a well-suited SMS Gateway provider and sign up with them.

Sunday, July 26, 2015

Visual Studio Tips and Tricks-12 : Create ASP.NET 5 Website in Visual Studio 2015(Community Edition)

By Francis   Posted at   11:19 AM   Visual Studio Tips and Tricks No comments

1) Open Visual Studio 2015.

2) Select File –> New –> Project

3) In the “New Project” window, select Templates –> Visual C# –> ASP.NET Web Application. Give valid name and select location then click “OK”.

NewProject-Window

4) During this post, ASP.Net 5 is in Preview. So in the next screen you can see the “ASP.Net 5 Preview Template” and select “Website”.

TemplateWindow

5) That’s it! You have created ASP.Net 5 website. It looks like below:

ASPNet5_Website

 

Happy Coding!!!

Connect with Us