TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Baris Halici
NA
23
615
Areas-Controller-Action Listing for URL Authorize
Jun 6 2018 10:11 AM
var areas = Assembly.GetExecutingAssembly().GetTypes().Where(type =>
typeof
(AreaRegistration).IsAssignableFrom(type)).ToList();
foreach
(var area
in
areas)
{
var controllers = Assembly.GetExecutingAssembly().GetTypes().Where(type =>
typeof
(Controller).IsAssignableFrom(type)).ToList();
foreach
(var controller
in
controllers)
{
var methods = controller.GetMethods(BindingFlags.Public | BindingFlags.Instance);
foreach
(var method
in
methods)
{
if
(method.ReturnType ==
typeof
(ActionResult))
{
lstControllerActions.Add(
string
.Format(
"Area -> Controller -> Action : {0} -> {1} -> {2}"
, area.Name, controller.Name, method.Name));
}
}
}
}
it can be a different method. As a result, i want to get all the urls from the application.
I planning authorization in the my application. And, I need these (area name, controller name, action name) to ask when a request is made. In short, the URL address. I tried these.
Example:
(AreaRegistration)
Trial1Controller
Home ActionResult >>> /Trial/Trial1/Home/
A ActionResult >>> /Trial/Trial1/A/
B ActionResult >>> /Trial/Trial1/B/
Trial2Controller
Examp
(AreaRegistration)
Examp1Controller
Home ActionResult >>> /Examp/Examp1/Home/
A ActionResult; >>> /Examp/Examp1/A/
Examp2Controller
Home ActionResult >>> /Examp/Examp2/Home/
lstControllerActions Result:
Area -> Controller -> Action : Trial -> Trial1 -> Home
Area -> Controller -> Action : Trial -> Trial1 -> A
Area -> Controller -> Action : Trial -> Trial1 -> B
Area -> Controller -> Action : Trial -> Examp1 -> Home
Area -> Controller -> Action : Trial -> Examp1 -> A
Area -> Controller -> Action : Trial -> Examp2 -> Home
Area -> Controller -> Action : Examp-> Trial1 -> Home
Area -> Controller -> Action : Trial -> Trial1 -> A
Area -> Controller -> Action : Trial -> Trial1 -> B
Area -> Controller -> Action : Trial -> Examp1 -> Home
Area -> Controller -> Action : Trial -> Examp1 -> A
Area -> Controller -> Action : Trial -> Examp2 -> Home
Everything is beautiful but, No connection controller between area.
Thanks, What is your suggestion????
Reply
Answers (
1
)
how to get value tiny mce body to into c# asp.net??
There is already an open DataReader associated with this cmd