I have to build a Web-Application using ASP .NET MVC. It has to serve different customers, each customer accesses the Page via another domain. With this domain the Application is supposed to load the customer specific data. It also has to provide a login mechanism.
I'm fimiliar with JSF, there I would solve this problem via webfilters.
Does ASP.NET MVC provide something similar to webfilters or is there an even better solution so solve this problem?
I really wish there was a tutorial or an example that adresses this problem, but after hours of googeling I could not find anything. I'm probably searching with the wrong keywords, but I don't know how mechanisms like this are called.
There are several ways of doing this, for example you could use routing (Is it possible to make an ASP.NET MVC route based on a subdomain?) but I would simply go with getting the username from the URL.
var user = Request.Url.Host.Split('.')[0];
Related
In my application I have various Views and Controllers.
So naturally when one navigate through pages the URL will change based on the Controller and the View;
E.g.
http://example.com/home/index
http://example.com/account/register
http://example.com/product/newproduct
But I would like to keep the Controller and View name in the address bar secret, in other words when one would navigate, the address bar always shows http://example.com
Does anyone know how to hide these routes? I'm an using ASP.NET MVC 4 C# application.
Basically just need the server to keep track of the pages.
Unfortunately, I believe that this is not going to be an easy task to accomplish. The MVC routing engine needs certain information to deliver the request to the screen and that information is handled when you map the route. Furthermore, you can imagine the kind of trouble people could get into if the browser allowed sites to alter the address ad hoc. Take a look at this video. It's pretty good about detailing how the routing engine works Pluralsight
I have started developing a site. Usually I use asp .net mvc 4 internet template because it has some per-built features, specially the Account Controller with simple membership. But I want to do more with the look of the login control. I want to use something like
http://bootsnipp.com/snipps/loginregister-in-tabbed-interface
But with current existing account controller and account Model how am I going to achieve these? I did some Google, but I could not find any concrete example or guideline to build the login form like that with the Account Controller and Model.
So here I am posting this problem, in the The Stack overflow, where the dedicated developers always provide a solution. Thanks in advance.
Im writing a web app using C# with ASP.NET 4.5/Entity as a backend. With Angular.js handling
most of the front-end/database query stuff. ASP.NET 4.5 makes it really easy to connect to
our active directory using windows authentication.
However will I run into problems when I scrap all the razor templates, and replace it with regular HTML/CSS and angular scripts. All I really need the active directory stuff for is to create permission for who can pull what file from our database.
Im pretty new to web apps, so far ive like the entity framework alot, but if you guys know a more efficient way (better back end) to do this feel free to tell me.
My app basically needs to allow users to upload spreadsheets and videos, search for them, and only allow access to users that are in certain AD groups.
We solved this problem by using MVC to render the HTML templates. In your controller or directive set the templateUrl to an action which does whatever logic is necessary to render the template for that user. Also, be sure to check user permissions in your AJAX calls.
Figured it out. Made a new web api controller
then added this function
public string getUser()
{
return User.Identity.Name;
}
haha that was easy.
However if anyone sees any errors i may run into doing it this way. Please point em out
I'm trying to make an application that can host multiple ecommerce front ends, so I need to figure out how to route all requests to one class which then parses templates and handles all output.
So my question is then how do I route all requests to one class?
In PHP I would use mod_rewrite and have all requests go to index.php and add "main = new MainClass();", but I have no idea on how to achieve this with ASP.NET
The MVC framework isn't what I'm looking for, since I will host several domains with one system.
It sounds like what you want is an HttpModule. (Sorry for the Google link, but there's a lot about this out there and I'm not sure which is the best resource for you.)
Essentially, what an HttpModule does is intercept requests between the web server (IIS) and the application (ASP.NET).
You can use the Route class to register route handlers for all of the routes you define. Basically, you would create one instance of an implementation of IRouteHandler (or different instances of the same type) for all the permutations of the urls on your site.
Also, it should be said that following statement that you made is misguided:
The MVC framework isn't what I'm
looking for, since I will host several
domains with one system.
Any problems or limitations you would run into hosting several domains in one system with MVC will be apparent in ASP.NET as well; MVC sits on top of ASP.NET, not separate from it.
I am trying to implement DotNetOpenid in my asp.net website. However, the more I try to read up on DotNetOpenid, the more confused I get. My initial goal is to allow user login process (similar to StackOverflow).
I attempted to get some help via this question dotnetopenid tutorial
but was unsuccessful (since I am not using MVC)
How can I get a tutorial that would help me accomplish that?
I would first start at the developers site
Coding Guidelines
Quick Start
Code Snippets
I have been posting my questions here Support Forum. Pretty helpful.
The ASP.NET OpenID web site (C#) project template isn't a tuturial, but it does create a functioning OpenID ASP.NET web site.
I just installed it and was able to get a site up and running. Here are a few gotchas that I ran into:
When you create a new project using the template, do not choose a deep path - this will create problems during database creation.
When you first run the application, you'll hit an exception - don't worry about it. When you get the YSOD, simply browse to the Setup.aspx page mentioned in the instructions.
If you don't have an OpenID, you'll need to get one. The initial page loaded after database creation has a 'Get OpenID' link if you need to get one. It's a simple process and only takes a few minutes.
Once you get through that, you'll have a working implementation of an OpenID web site.
You might also want to check out the DotNet OpenAuth ASP.NET Controls.
HTH
Edit
For anyone interested, there is also an ASP.NET MVC 2 OpenID web site (C#) template. I'm surprised #Andrew Arnott answered the other question and didn't mention these, since he is the author.