I'm trying change endpoints, and default pagaes of Microsoft Identity autentication in Blazor Project with azureB2C authentication.
I got two endpoints:
MicrosoftIdentity/Account/SignIn
MicrosoftIdentity/Account/SignOut
I want to change this on for e.g. account/SignOut.
After sign out, browser redirect to MicrosoftIdentity/Account/SignedOut, I want to change this rule.
I was trying create my own AccountController.cs but it's not work. I don't know, how can I use my own AccountController in this case,because Microsoft docs, don't explain this.
I discovered that, when I create file SignedOut.cshtml in Area.MicrosoftIdentity.Pages.Account, I can change view of default pages. But I get error about conflict
"warning CS0436: The type 'Areas_MicrosoftIdentity_Pages_Account_SignedOut'...."
I don't know what should I do. Sorry for my English, I'm still learning.
We have a legacy webforms app and a new section of our site developed with MVC. It works a treat as an application in the Default Web Site in IIS.
Only downside is that the root site's session object isn't passed to the application. We have a work around for this.
A consultant is convinced that we don't need to set it up as an application and it can all be done via handlers and route mappings. He conveniently has not provided us with any details though and I have been tasked to implement it.
The best I have achieved was to add a Module Mapping to the Handler Mapping section in IIS. This filters coolmvcapp/* with Module isapimodule to a virtual directory who's physical path points to our new MVC app. The result is an empty page with a 200 response. Most other combinations I have tried resulted in a variety of errors. (Turns out an empty page is returned without adding the handler mapping - hey ho)
So, is this approach even possible?
I am aware that MVC and webforms can be merged together but for reasons this is something that we want to avoid.
I will deploy my project in IIS and WS 2008.
I want to know how can I allow some controllers to be visited just inside my network and block people outside to see it.
Use the Request.Url property to check if the request is coming from another domain. Based on the url you can hide this.
Based on this
Either you check the url in controller action method or
Write Custom Authorization attribute
I am developing an orchard module, for which I have the "AntiForgery: Enabled" in the module.txt file.
However, I need a single action to skip the antiforgery check.
I have tried both,
[OverrideAuthorization]
[AllowAnonymous]
on the action with no success as I am still getting the following error when redirecting to the action from a thirdparty application.
The required anti-forgery form field "__RequestVerificationToken" is
not present.
I have also tried solutions such as Override Authorize Attribute in ASP.NET MVC
Any ideas as to why this would not work within an Orchard module?
I have unfortunately had to update the Orchard.Framework.dll as seen here - Opt out Antiforgery token per method
The problem with this is that anytime we upgrade to a new version of Orchard we then need to keep this in mind and re-implement it.
There has however been a pull request - Fix for issue 19384, so hopefully will form part of future versions of Orchard
Ok I had a huge Issue giving this a proper title, my excuses for that.
Anyways I have started slowly to look at Web and ASP.NET again, I am a C# developer but I have mostly worked with Windows applications the past 5 years or so, It is not that I haven't touched the web as such in that time, but this is as web services (Restfull as well as the ugly SOAP services) I have also worked with more "raw" web requests.
But I have not worked with IIS or ASP.NET in all that time.
What I would like to do is hos a web page that uses a URL style I could best describe with "like rest", hence the "Restfull urls" title. Because I think most people thinks of such URL's in terms of:
http://example.com/item/
http://example.com/item/23/
and so forth. Not that they have to look like that, however I would like to use such URL's instead of
http://example.com/item?id=23
I know subtext does this, but i have not had any luck finding it in their code base.
Now as far as I can tell I could just implement some IHttpHandler's, but at least for the examples I have seen of that, they write the page source back in code, and I still have master pages etc. I wish to use instead of taking over all that stuff my self, I really just kinda wants to route http://example.com/item/23/ to http://example.com/item and asking for the item with id 23...
I hope this makes sense at all >.<... And that someone has some better examples at hand that what I have been able to find.
You can achieve this using Routing here is a link to an MSDN blog, The .Net Endpoint - Using Routes to Compose WCF WebHttp Services that should get you started.
If you're looking at asp.net/IIS, another option to look at is ASP.Net MVC. It's pretty straight forward to create RESTful services.
Here's a tutorial:
http://www.codeproject.com/Articles/233572/Build-truly-RESTful-API-and-website-using-same-ASP
So here are your options-
For .net 3.5 sp1 framework with IIS7 you can use asp.net routing feature to have MVC style urls that you mentioned should create a custom route handler implementing IRouteHandler interface as explained here How to: Use Routing with Web Forms and register your route rules in Application_Start method in Global.asax. For your example you can register a route like this
routes.Add("ItemRoute", new Route
(
"item/{itemId}",
new CustomRouteHandler("~/item.aspx")
));
and then you can access itemId in your routed item.aspx page by checking request context item
requestContext.HttpContext.Items["itemId"]
For .net framework 4 MVC you dont have to create a custom handler, you can directly use
routes.MapPageRoute("ItemRoute", "item/{itemId}", "~/item.aspx");
in you global.asax Application_Start method.
This link explains more about the Routing
A way of achieve this is using URL rewriting.
If you're planning to host your Web application in Internet Information Services 7.x, you can take advantage of IIS URL Rewriting Module:
http://www.iis.net/download/urlrewrite
URL rewriting is just mapping a friendly URL to an unfriendly, common one, which is programming-friendly to inspect GET parameters.
For example:
http://yourdomain.com/item/48 => http://yourdomain.com/Items.aspx?Id=48