Publish Website On local Network Server IIs


How To Publish Website On local Network Server IIS


firstly you need to build your project then you need to create publish a profile of your project.
Here I am going to publish as a folder or in a directory then it will browse on a local network IIS 
that will be browse using their IIS  IP with the project name 

so first we are going to build the project and publish like this, go to solution explorer and then select project then right click on a project and then choose to publish 

in the publish option firstly you need to create Your publish profile by selecting your publish type 


Here we select publish profile type there are four option i will select folder option for local file 





publish on a folder and then choose folder or directory path where publish file saved And then for 



advance feature select advance link for the set more advanced feature and setting of the application



Then setting advance Option, Then click save

now update setting then you need to change profile default name to custom name 

now you have two option then you choose what you need rename or delete a profile, for rename choose rename option 


after choosing rename option you have another popup window will open where write your custom name and save it 
now the next step is finally to click publish button now check your output window show what output generated or see error window what error is occurred if everything completed success full then go to your network IIS server 

for host your site on or publish content host on IIS server of local server first login in your network server system remotely or physically Then Goto Start menu and write "IIS" for search IIS  server


Now your IIS will be opened and show the popup window now you go to the inside of default site


Now you need to add a new application setting where you publish your website


now your new popup window will show where you set your application setting like


here you can choose any unique name of the website in alias section and set application pool and choose the path of website content is located after file publish from visual studio. set their path and then test connection show one success and one warning. now its completed click on ok button
if Your website run successfully then its ok otherwise it will show something like this type of error

so it's a permission error in your publish content folder or directory so now setting up permission for different users of this site that serve it

right click on the application that you recently created and then allow there iis_users for access your site. then click on ok button and restart application like

and refresh browser if your site still not working then you need to set authentication setting. for it now you need to double click on the application and then choose authentication option and follow next steps. firstly disable



form authentication and basic authentication and asp.net impression will set disabled and other will enabled

now goes into window authentication section and set follow setting where popup will opened

Now setup NTLM at Top of your other provider and click on ok then restart the application and refresh your website your in the browser or click on browse link 

Token Based Authentication in Asp.net MVC Web Api

Token Based Authentication in Asp.net MVC Web API





1) You Can Use It Either New Project Or 
2) You can use It with New Project 
  
Procedure Is Same For Both Type of Project . Now I am Not Going too Deep Just Impliment Code and there Requirements . Lets Start including some packages from nuget and used with Some Custom Class Step By Step

1) . Firstly You Need To Install Three Package Of Owin 

  1. Microsoft.Owin.Host.SystemWeb
  2. Microsoft.Owin.Security.OAuth
  3. Microsoft.Owin.Cors
After Installing Packages From Nuges You need To write Some class And There Code Like this 

2). Create Class "AuthorizeAttribute.cs" with Right Click on Project



using System;

using System.Collections.Generic;

using System.Linq;
using System.Web;

namespace MYProject
{
    public class AuthorizeAttribute : System.Web.Http.AuthorizeAttribute
    {
        protected override void HandleUnauthorizedRequest(System.Web.Http.Controllers.HttpActionContext actionContext)
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                base.HandleUnauthorizedRequest(actionContext);
            }
            else
            {
                actionContext.Response = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.Forbidden);
            }
        }
    }
}



3). Now Create Another Custom Class With any name Like "MyAuthorizationServerProvider"


using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OAuth;
using MYProject.Common;
using MYProject.DataEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using System.Web.Security;

namespace  MYProject
{
    public class MyAuthorizationServerProvider : OAuthAuthorizationServerProvider
    {
        //public override async Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
        //{
        //   context.Validated(); // 
        //}
        PowerHMSEntities db = new PowerHMSEntities();
        public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
        {
            if (context.ClientId == null)
                context.Validated();

            return Task.FromResult<object>(null);
        }
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            var identity = new ClaimsIdentity(context.Options.AuthenticationType);
            string username = context.UserName, Password = GetSHA1HashData(context.Password);

            if (Membership.ValidateUser(username,Password))
            {
                var user = db.UserDetails.Where(c => (c.UserName == username || c.EmailID == username) && c.Password == Password && c.IsActive.Value.Equals(true)).FirstOrDefault();
                FormsAuthentication.SetAuthCookie(context.UserName.Trim(), false);
                identity.AddClaim(new Claim(ClaimTypes.Sid, Convert.ToString(user.UserID)));
                identity.AddClaim(new Claim("username", user.UserName));
                identity.AddClaim(new Claim(ClaimTypes.Name, user.UserName));
                var properties = CreateProperties(user.UserName);
                var ticket = new AuthenticationTicket(identity, properties);
                context.Validated(ticket);
            }
           
            else
            {
                context.SetError("invalid_grant", "Provided username and password is incorrect");
                return;
            }
        }
        #region[TokenEndpoint]
        public override Task TokenEndpoint(OAuthTokenEndpointContext context)
        {
            foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
            {
                context.AdditionalResponseParameters.Add(property.Key, property.Value);
            }

            return Task.FromResult<object>(null);
        }
        #endregion

        #region[CreateProperties]
        public static AuthenticationProperties CreateProperties(string userName)
        {
            IDictionary<string, string> data = new Dictionary<string, string>
            {
                { "userName", userName }
            };
            return new AuthenticationProperties(data);
        }
        #endregion

 public static string GetSHA1HashData(string data)
        {
            var sha1 = SHA1.Create();
            byte[] hashData = sha1.ComputeHash(Encoding.Default.GetBytes(data));
            var returnValue = new StringBuilder();
            foreach (var t in hashData)
            {
                returnValue.Append(t.ToString());
            }
            return returnValue.ToString(); // return hexadecimal string

        }
    }
}


3). Now You Need Owin Startup Class

using System;
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.Owin;
using Microsoft.Owin.Security.OAuth;
using Owin;

[assembly: OwinStartup("MYProjectStartup", typeof(MYProject.Startup))]

namespace MYProject
{
    public class Startup
    {
        public static OAuthAuthorizationServerOptions OAuthOptions { get; private set; }
        public void Configuration(IAppBuilder app)
        {
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888



            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
            //enable cors origin requests
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

            var myProvider = new MyAuthorizationServerProvider();
            OAuthAuthorizationServerOptions options = new OAuthAuthorizationServerOptions
            {
                AllowInsecureHttp = true,
                TokenEndpointPath = new PathString("/token"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
                Provider = myProvider
            };
            app.UseOAuthAuthorizationServer(options);
            app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());


            HttpConfiguration config = new HttpConfiguration();
            WebApiConfig.Register(config);
        }
    }
}

4). some Time Its Create Issue You Need To Update "newtonsoft.json" Dll file from Nuget



5). And Some Time You Need to  "Startup.cs" class in  "web config " 

 <appSettings>
  <add key="owin:appStartup" value="MYProjectStartup" />  
  </appSettings>


6). also Need to Update  "WebApiConfig" class 

here Register "AuthorizeAttribute" class like this 
   config.Filters.Add(new AuthorizeAttribute());  

example:- 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;

namespace MYProject
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services           
            // Web API routes
            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute(
            name: "CommonApi",
            routeTemplate: "api/{controller}/{action}/{id}",
            // routeTemplate: "api/{controller}/{id}",
            defaults: new { controller = "Common", id = RouteParameter.Optional }
        );
            config.Routes.MapHttpRoute(
               name: "DefaultApi",
               //routeTemplate: "api/{controller}/{id}",
               routeTemplate: "api/{controller}/{id}",
               defaults: new { id = RouteParameter.Optional }
           );
            config.Filters.Add(new AuthorizeAttribute());
            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;        
        }

        public static void Register(object configuration)
        {

            throw new NotImplementedException();
        }
    }

}


7). Now You Can Check Your Api With Postman Get Token





8). Use Api Token With Post Man


How much time does an OLA (Uber, Meru, TaxiForSure) like app take in development?

App : Online Taxi Booking
User App
Register/Signup
  • Login page will appear that will redirect to Home page
Signup/Login
  • Signup:- Facebook, Google, Mobile Number(OTP) / Skip
  • User can Sign in using Social media or by entering the phone no./Password
Login
  • Social media or Username, Password
Create New Profile Screen
  • In this screen user has ability to create new account by filling these parameters:
Upload Profile
  • First Name, Last Name, Email, Gender, Select Country, Address, Mobile Number, Password
User Interface & Map
  • User dashboard and Google map
  • Available Car types
Notification Screen
  • Ability to see Notification request accepted
  • Ability to see Notification request received
  • Notification after Payment Confirmation
  • Booking
Current location from map
  • Application will select location through GPS
User defined position
  • User can select desired position as pickup
Set Destination
  • User will have to enter the desired destination at time of booking
  • User can also change destination after arrival of driver
Get Ride Estimate
  • User can view ride charges info
Booking Process: Simple steps to book your ride
  1. Enable Location Service
  2. Open Taxi app in your mobile.
  3. Select Cab option (Mini, Micro, Sedan, Shared Ride etc.), or go with already selected one.
  4. Touch "SET PICKUP LOCATION".
  5. Touch "Request SEDAN", it will start trying to connect you with nearest driver.
  6. App shows your Car number plate, persons, distance, estimate button. Your Cab is booked. OTP generated
  7. Keep track of your cab on app, when it arrives, enter the OTP and take ride.
  8. At destination, driver completes the ride then rate your ride before taking next ride
Contact Driver
  • Contact Driver After Booking
  • User can call driver/track location in map
  • User can click to view Driver description
Track Driver
  • Driver can be tracked after confirming ride
  • User can view approx. time of driver arrival
  • User can call driver or cancel the ride
Ride Initiate Process
  • User will share the OTP with driver to begin the ride
  • Driver and User map will flow in parallel
Track Ride : How it works
  • Open the Taxi app.
  • Set up your Family Profile.
  • When one of your members takes a ride with Taxi under the Family Profile, you’ll be automatically notified with their trip details.
  • You can follow the trip’s progress live on the map within your own Taxi app.
  • The cost of the ride is automatically billed to you and you will both receive a copy of the receipt.
Other Detail
  • Share ride details (optional)
  • User can share ride details with Family
Destination reached
  • User can stop the ride / extend ride
  • When stop, ride charges will be displayed
Driver Rating
  • Rating is based on User experience
  • User can also view the trip (car info, driver info, charges & source and destination info)
User Menu
  • Name of User
  • Profile Image
  • Home
  • Payment
  • Notification
  • Setting(Change Pass, Emergency contact)
  • Customer Support(Data Call / Whatsapp Call)
  • Refer a Friend (Win free ride)
  • Logout
Payment / Feedback
  • Payment : Payment can be given through Cash/Card
  • Feedback : Feedback is based on travelling experience
Driver App
  • Functional Hierarchy / Screen Flow
  • Ask driver to enable the location
Driver Registration
  • Manual Registration (submitting copy of Car’s Registration certificate, Pollution card, driving License.) vehicle insurance, vehicle permit, share links of Social media (Facebook/Google +), Email ID, Phone number, Photos of them self and car, etc.
  • Online Registration (uploading copy of Car’s Registration certificate, Pollution card, driving License.) vehicle insurance, vehicle permit, add links of Social media (Facebook/Google +), Email ID, Phone number (OTP verification), Photos of them self and car, etc.
  • Admin have to Verify documents and make driver active.
  • Admin will provide login credentials to driver with Username and Password on their registered phone (SMS) or Email ID.
Login Screen :Social Media (Facebook, Google + etc.)
  • Username/Email
  • Password
Home Screen
  • Source, Destination, Car categories, location pin, Navigation bar, Map
Online Screen
  • Pickup Request (Time, fare, location)
Menu : Sidebar Menu/Navigation
  • Home, Notification, Driver Support, Setting, Dashboard, Earning (Today/Weekly-Amount earned, time consumed, trip taken i.e. list view), refer friend (invite link shared via whatsapp, Facebook, text etc.), Logout
Request : Accept/Reject Request
  • After being requested by user diver can either accept/reject the ride for that user
  • If accepted driver will have to move towards selected location
Location of Customer
  • After request is accepted driver will know the location of user
  • Driver can reach the location through GPS
Contact User after booking
  • User will be contacted by driver once Cab is reached on the source point or nearby user
Initiate Ride
  • Driver will ask OTP from user and begin ride
Track : Track through Google Map
  • Google map navigation will open by filling the User’s location
Payment/Feedback :
Payment
  • After reaching on destination user will pay for the ride
Feedback
Driver will enter ride feedback
Update Ride Info
  • When ride is finished, driver will update
Reach Destination
  • When User reaches the destination, he will stop the ride
  • Payment is done and driver is rated
Customer : Customer Experience
  • Driver can add the user experience on that ride
Customer Rating
  • Driver will rate the customer according to ride interaction and behavior of customer
Admin panel (Web) : Twitter bootstrap with ROR or PHP, Database PostGres.
Manage Driver/Customer
  • Admin have rights to manage the customer and driver
  • Features will be available to both the user and customer as per the requirements of driver and customer
Ride Booked by Driver/Customer
  • Rides booked by user can be seen by admin.
  • Rides being completed by driver can be viewed.
  • Rides not accepted by drivers can also be tracked, for analysis
Manage Driver through GPS
  • Admin have the capability to manage the driver location and routes taken through GPS
Flags for driver area i.e. boundary division
  • Flags will be set for driver so that driver will be available in particular area assigned
Overall history
  • History need to be maintained in case of an emergency, admin need to keep track of history regarding user and driver
All data will be accessible
  • An admin will have rights to access the data of driver and customer regarding drives being booked
Manage transaction
  • Transaction need to be managed through fare generation screen after ride is over
  • A secure receipt need to be generated when destination is reached
Add/remove vehicle category
  • App admin will have rights to add or remove driver as per performance and status of quality service
Base km/Mile, Base Fare, Fare per unit (mile Or km)
  • These fare depends upon the category chosen (Mini, Micro, Sedan, Shared etc.)
Valid driver info with vehicle
  • Fraud driver should be avoided with verified driver and vehicle registration.
  • Vehicle and driver document must be up to date i.e. driver license, car registration and pollution document
Manage document of driver
  • Driver and Car doc must be vali

Featured Post

how to find n number of nodes have child or cildren

 how to find n number of nodes have child or cildren for that we use recursive function  const   data = {     'id' : '0' ,...

Popular Posts