Sample OpenIdProviderMvc always responses with XRDS file - dotnetopenauth

I run project OpenIdProviderMvc from DotNetOpenAuth.Samples. It started whithout any problems, i can go to http://localhost:4864/ and aplication displays action Home/Index.
But after first authentication from relying party (in my case OpenIdRelyingPartyMvc which runs in second instance of Visual Studio) when i try to send request to http://localhost:4864/ the provider responses whit XRDS file, not view Home/Index as i expected. If i send request to http://localhost:4864/Home/Index all is ok.
Why XRDS file is sended when i request to root link of application?
I want to include this openId provider into my application, but this unexpected behaviour makes it impossible.
EDIT1:
I found that XRDS file is cached so it is always outputed. But when i remove from view which generates this file line
<%# OutputCache Duration="86400" VaryByParam="none" Location="Any" %>--%>
the OpenIdRelyingPartyMvc app displays error:
No OpenID endpoint found.
Solved: I have set cache duration to 1 and now everything works as i expected.

Related

Access to a PDF File in a http with dinamyc variables

Hello everyone (sorry for bad English), i'm getting crazy with this problem... i'm working on a project with NiFi expecting to download PDF files from a public Goverment page. The main problem it's that the page you request in a web browser shows the correct page like this
Asking the same page in NiFi (also testing in postman) shows that the session has expire, then looking at the HTTPS POST with the development tools in chrome i notice that there are multiple headers that contain dynamic variables
Is there any form to replicate web browser behaviour on NiFi?

All Invalid Random Paths in the URL Return The Normal Web Page Instead of 404 Not Found Page

I have a website:
https://www.includekarabuk.com
For instance this url contains an article:
https://www.includekarabuk.com/kategoriler/genel/Siber-Guvenlikte-Dusuk-Seviye-Aciklik-Nedir.php
But when I add invalid path to the existing url, page is still being showed.
https://www.includekarabuk.com/kategoriler/genel/Siber-Guvenlikte-Dusuk-Seviye-Aciklik-Nedir.php/test123343242314321423423423/
https://www.includekarabuk.com/kategoriler/genel/Siber-Guvenlikte-Dusuk-Seviye-Aciklik-Nedir.php/sdfdsfdsfsdfdsfsdfsdfsdfsdsdfdsfsdfd/
https://www.includekarabuk.com/kategoriler/genel/Siber-Guvenlikte-Dusuk-Seviye-Aciklik-Nedir.php/132432432/
But because css and javascript file locations will be invalid due to added extra path, page is displayed as broken.
I want to stop this. When the web server receives invalid path as with above, it should respond as 404 not found page coming from web server. How can I do that? I am using Apache web server and php scripting language.
Note: I am not using any MVC framework.

Microsoft Sign-In for ASP.NET MVC 5 web role

I have created Azure cloud service and in this cloud service I have a web role serving as a MVC web application. I followed this tutorial to use Microsoft account as the external authentication. When I try with the localhost it works perfectly. However, after I deploy the cloud service, I changed the redirect URL to the site url which is http://109e199cf5864b50ab25ac839f8c151d.cloudapp.net/. But this doesn't work. I can reach the authorization part, but after I login with the Microsoft account I got Error Message: An error occurred while processing your request. What should I do to make it work?
UPDATE:
I tried to remove the [Authorize] tag in my controller so that I don't need to login to see the view. After I deployed again, I got the Error Message directly!!
I didn't login at all! I checked the code this Error Message is actually the Error view from the template in the Shared folder. But there is no change of the code to return me this Error view! What I am missing with the deployment here?
In the comments of the blog post you referenced, the author (Ben Day) said there was an update to the redirect URI.
With the latest version of the ASP.NET Identity code, the redirect uri is a different value. So on account.live.com, the redirect url value for your app is now going to be “http://myapp-url/signin-microsoft”.
You may want to check that you have the correct values here.

Static images and CSS not showing (401) but bundled css and js do

We just deployed an ASP.NET MVC 4 webapp in production and are experimenting a strange behavior : the app works but images are not showing and part of the CSS is not loading.
When analyzing the HTTP requests, I can see that :
requests to images (*.png) fail with a 401 status code
requests to css files fail with a 401 status code
requests to bundled resources (*.js / *.css) are successful.
The application has worked properly in our Dev/Integration/Staging and Pre-Prod environment so I expect it to be some IIS configuration trick ....
We have already checked that :
only anonymous authentication is enabled in IIS
the IIS Pool user has Read access to the resources
I should add that some old HTTP modules are also configured (they take care of redirecting the user to some login page if he is not authenticated ...)
(I don't know whether this is relevant, but the app fails with HTTP status 401 when accessing its root Url (virtual directory) without the trailing slash ... i.e. https://{the domain}/{WebApp Name} fails but https://{the domain}/{WebApp Name}/ works fine)
Any clue about what might be going on ?
Thanks !
I was able to fix it by..
Navigating to folder that has css files in IIS
Double click "Authentication" icon on "Features View"
Right click Anonymous Authentation as shown in the pic and select Edit
Select "Application pool identity" option as shown in the pic
Restart the website
I could finally figure it out ...
Anonymous authentication was enabled (and using default config implying that the user seen by the code is the user IUSR).
The files for the web app were not stored locally where IIS is installed, but on some sort of network shared drive ....
In that place, IUSR had no read permissions, and could therefore not read the static resources.
I had to change the default "pass-though authentication", specifying that local execution is not done as the "authenticated users" (IUSR in that case).
In the WebApp Basic Settings in IIS, do not use "pass-throuh" authentication, use "Connect as"
HTTP 401: Not authorized
What this means is that your images and css files are in a folder which requires authorization, and the web site user is not authorized to see them.
You can use:
List item web.config location elements
or create specific web.config for the css and images folders, and allow anonymous access
Setting authorization rules for a particular page or folder in web.config
Struggled with this as well... Solved it by using #Styles.Render("Location_and_Name_of_CSS_file") inside my shared view as opposed to the HTML "link" tag
Hope this helps somebody
In my case none of the above was enough to fix the issue. After spending almost whole day on this I've found out that I also had to change my View to use #Url helper.
Before I had:
<img src="/Home/RetrieveImage" alt="" width="200" height="200">
It worked if I accessed via direct Url http://localhost/{applicationname}/Home/RetrieveImage but did not load the image on Index View as it should (error 401).
I changed it to:
img src="#Url.Action("RetrieveImage")" alt="" width="200" height="200"
and issue got resolved.
To get this working with pass-through authentication:
Set app pool identity to NetworkService user
Set Connect As to "Application user" on IIS site
Open the physical path and add read permissions for "NETWORK SERVICE and [local machine]\Users"
Although the app pool is set up to user NetworkService, local\Users also requires read access to the physical path.
You can also try running IIS as Administrator.

WCF showing the "You have created a service." page instead of WSDL

I have a WCF service running inside an ASP.NET MVC 4 application. The site is running on IIS8 on Server 2012. Until recently, the WSDL pages loaded without any problems. This week, the WSDL no longer loads. The link from the "Welcome" page is correct, but when I click it or attempt to generate a client, the same Welcome page is returned.
I have tried this using a ServiceRoute and also using an .svc file.
The ServiceRoute looks like this:
/DataService
Its WSDL link is:
/DataService?wsdl
The .svc file looks like:
/directory/otherdir/DataService.svc
The WSDL link is
/directory/otherdir/DataService.svc?wsdl
I never needed any configuration in the web.comfic section before, using the SerivceRoute.
How can I get WCF to show the WSDL correctly?
I ran into this before and there can be multiple reasons, the service is not functioning due to errors in the operations or you may be using WebServiceHostFactory instead of ServiceHostFactory
RouteTable.Routes.Add(new ServiceRoute("DataService", new ServiceHostFactory(), typeof(MyServiceType)));

Resources