|
Thank you very much for your response.
deflinek wrote: If you just want single action method that behaves differently depending on user's group then just implement the logic there.
I would like to clarify your above statement, if you are suggesting I implement the logic in the "MultiController" class or "PrincipalPro" class.
Currently I have two users group full and limited. I have to provide data api controller (localhost/api/data) to user group 'full' and data2 api controller to user group 'limited'. I would like to be able provide one link to the users, where they login and the system automatically redirects them correct data controllers.
So my question is, that is their specific filter/method function i could use or some kind of example/framework i can use a guide for this logic, as I am currently struggling to out this together.
I hope this clarifies my issue a little clearer.
Thank you for your help.
|
|
|
|
|
I suggest to implement the logic in MultiController class. I assume you need to return different set of data depending on their role. In that case you can attribute the MultiController class with [Authorize] so you force user to login before accessing it's methods, then return different data depending on user's role.
i.e.
public SomeResult Get()
{
if(User.IsInRole("Admin"))
{
return FullData();
}
else
{
return RestrictedData();
}
}
Does it make sense?
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
I am writing to seek help, as I am experiencing - No overload for method 'Get' takes 0 arguments error, on the "return result.Get();" line of user controller class.
public class UserController : ApiController
{
public HttpResponseMessage Get([FromUri] Query query)
{
if (User.IsInRole("admin"))
{
var result = new ValuesController();
return result.Get();
}
}
}
public class ValuesController : ApiController
{
private cdwEntities db = new cdwEntities();
public HttpResponseMessage Get([FromUri] Query query)
{
var data = db.database.AsQueryable();
if (query.name != null)
{
data = data.Where(c => c.Name == query.name);
}
if (query.price != null)
{
data = data.Where(c => c.Price == query.price);
}
if (!data.Any())
{
var message = string.Format("error");
return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
}
return Request.CreateResponse(HttpStatusCode.OK, data);
}
}
Any advice would be very much appreciated. Many thanks.
|
|
|
|
|
Please try
return result.Get(query);
on 8th line
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Hi,
Kindly suggest me that, i want to schedule any operation (eg. mailing daily report)on the server side in ASP.Net MVC. I searched over internet and found that either use Windows Service or console app. I need suggestion regarding whether i use Window service or console app (or any other solution), kindly suggest me what if i have hosting with shared server.
Thanks
|
|
|
|
|
The best solution depends on your hosting options. Windows service is good solution and widely used (at least in companies I worked for ) however requires admin access to the server that is usually much more expensive.
If your hosting allows for scheduled "execute url" task, then you can create an action to send your report and schedule it for daily execution.
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
"If your hosting allows for scheduled "execute url" task, then you can create an action to send your report and schedule it for daily execution."
Kindly can you please elaborate little more the above statement.
Are you talking about task scheduler?
And Thanks for your reply deflinek
|
|
|
|
|
The asp.net hosting that I use for my personal website allows for scheduled tasks apart of the website itself. There are some preset types of tasks I can choose from - database backup, send email, send files by ftp and check if website is alive.
The last one allows me to provide url that should be checked and I get an alarm email if response was anything but 200.
I use that for weekly reports as the url I provided generates the reports and sends emails.
As the hosting I use is quite cheap (about $35 per year), I think other hosting companies provide similar functionality.
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Thanks deflinek i got your point.
|
|
|
|
|
Assume that there is a web application has been hosted in IIS. And there are three users trying to accesss that web application from three different machines. Now how does IIS handle all the http requests from three different machines to access the same web application?
Thanks & Regards
Ashok
|
|
|
|
|
The question is very broad and does not point to any specific problem or issue.
Ashok Natarajan wrote: Now how does IIS handle What do you mean by how?
|
|
|
|
|
|
How to apply CSS to Ajax HtmlEditor Control.
I have created a Layout that i want to bind with the HtmlEditor Hoe can i do that? need Help ????
|
|
|
|
|
Hi,
We have all our code base in team foundation server.
All of a sudden i am getting this error message, related to getting the latest files from TFS. It is not able to able to load the main web site project, resulting in this error message.
I have VS2012. I had no issues in past opening the solution, it is just the past week that i am having a problem.
But my fellow developers have VS2010.
Visual Studio needs to make non-functional changes to this project in order to enable the project to open in this version and Visual Studio 2010 SP1 without impacting project behavior.
I am not able to reload the main project, comes up with
<pre lang="text"> error : The Web Application Project Emerson is configured to use IIS. The Web server 'http://localhost/' could not be found.
I am at my wits end trying to research this issue. Any thoughts? anything i missed?
Much much appreciated!
|
|
|
|
|
Hi All,
I solved this issue by addressing these two items:\
1. Regarding the first error, need to remove the following tags in the csproj file
<FileUpgradeFlags>0</FileUpgradeFlags>
<UpgradeBackupLocation>blah\blah\blah</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
2. Regarding the IIS error, I had to do this:
<UseIIS>True</UseIIS> change to <UseIIS>False</UseIIS>
I have another URL in place, and dont really use the localhost, my website has a defined another url in IIS, like http://mydev.ee.com.
But i am still using IIS, how does this still work?
many thanks,
|
|
|
|
|
|
Make online compiler - or expose an existing compiler online?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
|
I listened closely...and it's clear that you have no idea what are you talking about. Just for put something before you - one of the best c compilers has over 7 million (7000000) lines of source code...
Other things that you may not know about is how to ask - nicely...
prince_crazy wrote:
listen i don't have time to explain my question again |
If you have no time - go on...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
|
|
Are you asking how to write an online compiler?
Veni, vidi, abiit domum
|
|
|
|
|
The answer is:
Quote: listen i don't have time to explain my question again..
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
no how to make online compiler in c#
|
|
|
|
|
OK, so you are not planning to write it, but how do you expect to 'make' it? One possibility is that you have the compiler on your website, and allow a user to enter the source code on a web page. You then send that source to the server, compile it, capture the output and display the results back on the web page. You would then have some object code on your server, so what would you expect to do with that?
Veni, vidi, abiit domum
|
|
|
|