Posts

Showing posts from February, 2020

Donate

Custom AuthorizeAttribute Class In ASP.NET MVC

Hello All! In ASP.NET MVC projects, you would normally handle Unauthorized users if they access to a page in which they don't have access to. To do this I have a custom class that inherits the AuthorizeAttribute class. This class was take from accepted answers in stackoverflow with some modifications according to my needs for the project. Here's the complete AuthorizeUser class. using System.Configuration; using System.Web.Mvc; namespace AuthenticationDemo { public class AuthorizeUsersAttribute : AuthorizeAttribute { private string redirectUrl = "" ; public string NotifyUrl { get { return redirectUrl; } set { redirectUrl = value ; } } public AuthorizeUsersAttribute() : base () { } public AuthorizeUsersAttribute( string redirectUrl) : base () { this .redirectUrl = redirectUrl; } protected ov

How To Debug Or Step Through A WCF Service In ASP.NET MVC Application

Hello, In order to step through the WCF project in debugging mode through and ASP.NET MVC, follow these simple steps. WCF Project 1. Right click on the Solution of the WCF Service Project 2. Choose Properties 3. On Startup Project -> Select Multiple startup projects 4. On the Action dropdown of the WCF Service project, choose "Start". ASP.NET MVC Project 1. Run the WCF Service Project using the default web browser 2. Add a WCF connection using Connected Services (Make sure to type the correct url of the service). See web.config value below. 3. In web.config, add an endpoint element for the WCF service. <endpoint address= "http://localhost:63070/Service.svc" binding= "basicHttpBinding" bindingConfiguration= "BasicHttpBinding_Service1" contract= "DataLocalHostService.DataService" name= "BasicHttpBinding_Service1" /> 4. In your controller, you may call the service based from

Donate