Check wither internal / external DNS | ASP.NET WEB FORMS C# - c#

I have a specific web page developed using Web forms c# that should be accessed through only an internal DNS.
the whole site can use both external and internal except for this page.
So, my question is how can I check wither the user is using internal vs external DNS in the backend c# code ?
Thank you for your help.

If you want to do it on the applicaiton level, you will need some form of authentication. Basically you can implement any kind of authentication, but to start I would recommend to look up IPrincipal. Here's a starting point: https://learn.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-security/introduction/an-overview-of-forms-authentication-cs
If you want to do it on the network level you might deploy this one page as a separate application, then do the checking on the IIS level.

Related

Communication between web applications

How can I communicate between web applications?
I have an application that manages my web application with other applications: When I login to my application, it lets me connect to another application.
I work in VS2015 ASP.net MVC, c#. Help, please!
I am not sure what do you mean here by communication.
it can have two meanings -
Page Re-directions from one web app to another:
You want the links of other applications to be included in one application and then when user clicks they can redirect users to those respective pages. If you have SSO implemented, they will not even ask the login information.
This would be simple, you have to include anchor tags with targets of other web sites.
As long as they are hosted under same domain name, it would work.
If they are not hosted in same domain name, then you will have to enable CORS in those web sites to allow requests from other origins.
Secondly, by communication, you may mean to just call APIs to get some data in current web app
For this you will have to write the RESTful APIs from other applications which cater to your needs.
Then you can call those APIs like any other web API call.
Here also, if the other applications / APIs are not hosted under same domain name, you will have to enable CORS.
For enabling CORS in your application, please refer this MSDN article.
For creating APIs, you can refer this MSDN article.
Again, this is not directly answers to your question. But I am sure this has provided enough details to think about integrating with other apps.
Hope this helps.

Aspx Support PWA or Not

Are there any way to do a project using pwa concept in ASPX page? I am using HTML with PWA, it was working fine but I moved into the ASP .NET. It doesn't work anymore and the JSON file is not loaded.
You will maybe found this SO post useful.
After testing, i was successful at implementing the functionality by
adding the serviceworker and manifest to a ASP.NET MVC application.
Since the view (HTML) gets rendered in the backend, it's only possible
to cache an static version of your web application. So preferable you
should use angular etc to generate your HTML.
A progressive web app works on IIS and apache web server.
progressive web app is a general concept. It has nothing to do with your web server. Please give more details about your code architecture etc
you can also use swtoolbox plugin for handing client side caching
mybe your problem is client-side caching. however PWA concepts are as follows, neither of them has nothing to do with web server type
Progressive - Works for every user regardless of their browser
Responsive - The app works on any form factor whether it's desktop, mobile, or tablet.
Connectivity-independent - Allows the user to use the web app even if it's offline.
Native Look-and-feel - Acts and feels like a native application, but is strictly web-based.
Safe - Always served up to the client through HTTPS.
Discoverable - Even though it's an "application," it can be indexed into a search engine.
Re-engageable - Allows re-engagement through features like push notifications.
Zero-Deploy hassle - Allows users to add the web app onto their home screen without the issues with app stores.
Link-friendly - Allows you to reshare using a Url.
Yes finally I able to accomplish this. PWA now works not only on ASP.NET webform but On any framework.
https://github.com/cpbenipal/PWA_Aspx

ASP.net MVC 4 web application with web service sharing its code

I have written a MVC web application that is used on our corporate intranet. We also have an MVC web site that is a seperate web application that is used by our customers. For our website to talk to our intranet systems database I have written a c# web service to access it.
The problem I have now is in the intranet application I have a complex routine that does some calculations that I now need in the web service for the website to do the same thing. I do not want to copy the logic and have it repeated in 2 locations for obvious reasons, so I need the web service and web application to share the same code base. I know this is possible but what is the best was to go about the use of application variables stored in web config files. For example if I move the code out of the intranet app and into a class library I will loose the functionality of being able to access the webconfig file, so where do I put these variables?
Any Suggestions on the best way to do this?
I will loose the functionality of being able to access the webconfig
file, so where do I put these variables?
You won't loose that ability. Every part of your application can access the configuration file, for instance by using the ConfigurationManager.AppSettings property.
Put the shared code in a class library that is referenced from both the web site and the web service.

using a cookie/session instantiated by another application?

-- background --
I have a customer intranet (ASP.NET / VB) thats instantiating an asp.net session checking various things in the dblogin process. The Intranet has various sub-systems.
The marketing sub-system requires an app_role to be assigned to the Intranet user for them to view the section.
I need to create a new booking form for this section but the code appears to use a generic form which is use throughout the site in various other sections. So its not a good idea to ammend what is currently there.
-- My plan --
Create a new application in C# / ASP.NET and also in IIS. (rather than a new site, create an app within the Intranet site in IIS)
Will I be able to check for the session thats currenting set in the cookie?
If the session is open then the user is able to see the Intranet and I assume I will need to do some checks for the app_role too.
I am simply going to put the URL for the app in the menu for marketing and then do another check just incase someone gives the URL to someone who doesnt have access to the menu.
--My Question--
Will i be able to check and use the cookie thats been instantiated by another application?
No - Sessions (session cookies) are application specific. You can try sharing sessions between applications via SQL and see if that works. As for membership/roles, see this.
Still, unsure why building a separate (web) app (which introduces the issue) is the way to go. If your plan is to introduce another form then why can't this be done in the existing intranet app?

Can we use Authentication in 'Forms' and as well in 'Windows' for a .net web application

We have an application in Access for UI and MS Sql server as Database server. We now decided to build a new application in web application for UI. This web application is only used by the employees who work for the company. But later we decided to host this web application on outside server. So the user (from this company only.) can able to login anywhere in the world. First I thought creating the web application using 'windows' authentication thinking we may be using it as an intranet web application. But now my manager asked me to use both 'Forms' and as well as 'Windows' for using this application and this web application will be hosted on outside server. I really don't catch his point of using both types of authentication.
Please help me is there any ways to use both authentication methods and please also suggest me why we might need to use both authentication methods. If so could you please help me with some instructions of using the both authentication types. Thank you so much for taking time to read and understand my question and helping me in this regard.
#Will explained in his comment as to why both forms of authentication is preferred. The following article shows one way to implement what you need.
You may also want to check the following article to better understand how Windows Authentication works.

Categories

Resources