I have two applications hosted and running in IIS in my windows server.
App A: Dot net core 3.1 application running on 80/443 port handling requests from external clients.
Site B: Hosted on a different port, say 32342, which has sensitive data and serving html pages.
App A is exposed to external network. Site B is behind firewall and not exposed to outside network (Port is blocked by firewall).
Whenever a new request comes to App A, after authentication, it should serve corresponding page from the Site B.
After searching several options, I came up with the option of Server.Transfer(). Unfortunately, it is not supported in Dot net core 3.1
I read about URL Rewrite. But it rewrites all the requests. I just need to serve contents from different server after authentication only for couple of controllers. How do I achieve this inside a Controller.?
(Other better options to serve webpages after authentication is also welcome).
Related
I'm new to Federation Services and I'm trying to understand how ADFS works as a whole and I've started to get down into the details. I followed along with creating an app using OIDC to authenticate a user, however, within the tutorial, they specified using a "Server Application" when setting up an Application Group. This ended up not working for me so I tried setting up a "Native Application" application group for kicks and was able to successfully login.
The thing that threw me off is, I ended up hosting ADFS on a server outside of the domain in which I had my application running, so I'm confused as to how that is "native" in terms of ADFS.
I went looking for this answer within microsoft's documentation but I didn't find the information very clear.
Native Application:
"Sometimes called a public client, this is intended to be a client app that runs on a pc or device and with which the user interacts."
Server Application:
"A web application that runs on a server and is generally accessible to users via a browser. Because it is capable of maintaining its own client 'secret' or credential, it is sometimes called a confidential client."
This may seem simple to some, but I'm trying to really get a grip on what would be used when. To me it sounds like a native application is used when you're running the application natively on a pc in which the user is also using the same pc, and the server application is run remotely in which the user would not be using the same machine. Is it really that simple or am I misunderstanding?
A native application (in Microsoft speak) is something that is not browser based e.g. mobile. The code runs client side. It may use JavaScript in which case the secret key is publicly accessible. (The secret key is one of the OAuth parameters). You use ADAL / MSAL to access it.
A server application runs server side e.g a web API. The secret key is not publicly accessible. You use OWIN to access it.
These terms have no relevance to where ADFS is actually installed. Native applications typically are not domain joined.
I know about xamarin connection with SQLite but it is locally
I need to connect my remotely MySQL database with xamarin.forms (I know about the security issue of this without using web services layer, but i will only use it for my own work)
This plugin is for xamarin.iOS and Xamarin.Android
I cannot add it using dependency service because i cannot add this component to the shared project
So is there any example of connecting MySQL database with xamarin.forms
You can't add references to your shared library. Shared libraries act like a list of files that are directly included in the project. The advantage of shared projects is just, that you do not have to maintain these included files for each project that uses code of the contained files. See the Xamarin documentation for further explanation.
What you have to do, if you want to consume a 3rd party libray within a shared library: Add the library to each project that uses the shared library (e.g. your iOS and Android project)
2ct to the mentioned security issue
You are right about the security issue. That's why I'd advice against, using mysql directly from your app. (I'll explain it for other readers that aren't aware of this problem and stumble over this question)
You should tunnel it through HTTPS because:
Some networks just block certain ports (HTTP and HTTPS are usually not blocked)
You publish your credentials with your app either statically or dynamically, but the credentials to your database are interceptable either way. You should authenticate a user and not an app. So there should be some kind of authentication / authorization that is revokeable. There was a nice talk from Kerry Lothrop on the Xamarin Evolve 2016 on this topic. https://www.youtube.com/watch?v=uLFtQHNxGaI
I have an application that displays my razor views of servicestack endpoints as expected on localhost. However when deployed to azure websites a particular page displays the metadata page for some reason. I don't know how to work out what has gone wrong as it all works on my machine :).
For reference, the view name matches the return DTO. I've tried the site in release mode on my machine. All other pages display as expected on azure and locally. I've cleared the cache and re-started the site from the control panel. I'm running out of things to try.
Any ideas appreciated.
Some general troubleshooting approaches that might help you:
Use Postman, cURL or Fiddler to watch the HTTP traffic between your computer and the website, looking for clues in HTTP headers, requests and responses.
Using FileZilla, connect to your website via FTP. Download the content of /site/wwwroot to a new directory on your local machine. Add this as a virtual website in IIS and run it locally. You'll be running exactly the same code that is deployed.
Instrument your application with tracing in a similar fashion to ASP.NET Tracing and look for exceptions or any other odd behavior.
Refer to Troubleshooting a Web Site for additional resources.
I am planning to build a production application for a small & medium business. This is an intranet application with maximum 15 to 30 concurrent users. The proposed architecture is:
Client: Firefox browser
UI: HTML, JavaScript, CSS
Communication via: jQuery AJAX
Middle Tier: Window Service hosting WCF Service (using webHttpBinding)
Database: SQLServer 2012 Express Edition
In this architecture the missing part is a WebServer that will serve the static HTML pages. I do not want to go in with IIS mainly because of the following reasons:
Keep the cost of deployment down
Most of work is being done in the Window Service hosting WCF Service
Since most of the middle tier work is done by my Window Service hosting WCF Service and my UI is HTML, JavaScript & CSS, can we do away with the WebServer like IIS or other WebServers supporting ASP.NET technology and use a lightweight WebServers which serves only static HTML pages something like lighttpd, nginx etc?
Are these light weight WebServers like lighttpd, nginx suitable to host in production environment.
There might be an issue of AJAX Cross Domain requests as Window Service hosting WCF Service and the lightweight WebServer may run on different port but on the same IP address. We can probably overcome this by opening it up to cross domain requests as it’s an intranet application.
One of the ideas behind this architecture is that I want to try and reuse this in other projects which are bigger in size.
Please let me know if this is possible and the related pros & cons of this approach. I am also open to any other suggestions which will help me improve this architecture.
I think you're overdesigning it for such a small site. If you're anyway going to run a WCF service it shouldn't be a problem to use IIS.
I'd suggest to either use ASP.NET MVC and do the html rendering on the server, or to go for a client side library such as angular.js in combination with Web API.
when I try to access a page on my IIS Express in a LAN (e.g. 192.168.1.123:3766/Host/MyPage.aspx) from my HTC 8S with Windows Phone 8 I get an error message that says "Unsupported address Internet Explorer Mobile doesn't support this type of address and can't display this page.
Is it possible to get this to work and if so how?
You need to specify the protocol. Try http://192.168.1.123:3766/Host/MyPage.aspx.
You will also need to follow the instructions here to make sure that your IIS Express is serving up on a port which your phone can see.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580(v=vs.105).aspx
In particular follow this section:
Quick solution with IIS Express
Create a firewall exception to allow HTTP requests through the firewall on the port that IIS Express is using.
Get the IP address of the development computer, if necessary, by running ipconfig.
Find the IIS Express configuration file, applicationhost.config, in the folder %USERPROFILE%\Documents\IISExpress\config. The USERPROFILE environment variable typically has a value of C:\Users\.
Open applicationhost.config with Notepad or another text editor and make the following changes.
a. Find the site element for the web service, WebServiceForTesting.
b. If you don’t see the site element for the web service, you have to deploy the service at least one time to create the element.
c. Within the bindings section of the site element, copy the binding element and paste a copy directly below the existing binding element to create a second binding.
d. In the new binding element, replace localhost with the computer’s IP address.
Save the changes.
Run Visual Studio as administrator and open the Visual Studio solution.
And beware of:
Important Note:
On a corporate domain, the emulator appears as a separate network device that is not joined to the domain. As a result, you may also have to get an exception from your IT department before the emulator can connect to services that are running on the domain-joined development computer.