Question

Redirecting to html page in .net core setup

Hi Team,

We have sales teams 7.18 .net core in windows system (on permise setup). We want the user to redirect to “Thankyou.html “ (a static html page we created) on hitting a custom web service (configuration service). We are facing challenges in the following areas:

 

1. Placing “.html” landing page in  .net core setup:

We place the “.html” page usually in the path:  \Terrasoft.WebApp\Nui in .net framework setup. However we are not sure where exactly where the html file has to be placed in .net core folder structure.

 

2.Redirecting to landing page in configuration service:

We use the following code in configuration service method to redirect to html page in .net framework setup

WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Redirect;

WebOperationContext.Current.OutgoingResponse.Headers.Add("Location", baseUrl + "0/Nui/ThankYouPage.html");

 

We are not able to use the same piece of code since “WebOperationContext” is not available in .net core.

 

Kindly help us in this regard.

namespace Terrasoft.Configuration.UsrAnonymousApprovalService
{
    using System;
    using System.ServiceModel;
    using System.ServiceModel.Web;
    using System.ServiceModel.Activation;
    using Terrasoft.Core;
    using Terrasoft.Web.Common;
    using System.Linq;
    using System.Text;
    using Terrasoft.Core.DB;
    using Terrasoft.Core.Process;
    using System.Collections.Generic;
    using System.Data;
    using Terrasoft.Common;
 
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class UsrAnonymousApprovalService : BaseService
    {
 
        [OperationContract]
        [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,
        ResponseFormat = WebMessageFormat.Json)]
        public void GetApprovalStatus(string token)
        {
			//do some process
 
			//System setting to get baseUrl - https://mycreatio.com/
            var baseUrl = Terrasoft.Core.Configuration.SysSettings.GetValue<string>(SystemUserConnection, "SiteUrl", "");
			WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Redirect;
			WebOperationContext.Current.OutgoingResponse.Headers.Add("Location", baseUrl + "0/Nui/ThankYouPage.html");
 
 
        } 
 
    }
}

Thanks,

Gokul

Like 0

Like

2 comments

Hi Gokul,

 

I am afraid this is not possible since netcore doesn't support System.ServiceModel.Web namespace where the WebOperationContext is located. You need to find another way to perform this redirect.

 

As for the file itself: netcore app won't let you store the file inside the binary files and use it as a part of the system. But if you find a way to perform the redirect you can deploy the ThankYou.html as a separate website and redirect to it in the code.

 

Best regards,

Oscar

Oscar Dylan,

Thanks for the response Oscar. I believe the case service response (smiley faces) also redirect to a html page where we enter a feedback. Is something like that possible in .net core?

Show all comments