views:

350

answers:

3

I have two applications, say app. A and app. B. App A. sends form data (using the post method) to app B. B however, is a web application and uses forms authentication. The post data is send to a webpage (viewdocument.aspx) which is secured by forms authentication. But when the data is send to viewdocument, the login page is displayed because the user isn't authenticated.

The point is, I want the post data to be read by viewdocument. How can I do this?

A: 

If your web app is only for accept data use web-services.

merin
It's not only for accepting data. The requested page must be displayed and therefore the user must be authenticated
Martijn
You could encrypt the authentication param as the token with the request while posting to App B. You can decrypt, authenticate and then allow the user.
Kalpak
But this depends on how much security you would like to have. If it is a internet app, the above approach is not recommended
Kalpak
A: 

You can allow all users to access your viewdocument page (by setting authorization in your web.config), get the values of the post in your page load and then, manually do:

if (!User.Identity.IsAuthenticated)
  FormsAuthentication.RedirectToLoginPage();

//Else continue with page display

This way, you will protected the display of your page but be able to send data to the page with any user.

I hope it will help

mberube.Net
That's a nice solution, thnx
Martijn
A: 

I think you want to consider separating out the two process - accepting data from another web site, and displaying data to a user. This way the you get nice separation of logic which can improve maintainability. And I'm not sure how you are going to go POSTing data from one website to another as POST should go back to the original webpage. I would do as @Kane suggested in his comment and use a service to accept the incoming data. This could be built to accept the current data, but would also be easily extensible if you ever need to receive data from other sites. Your page for displaying the data would then be a lot more simple and clearer for developers to work on.

iamdudley