locked
How does a Web Form interact with a Reference item and is debug possible? RRS feed

  • Question

  • User2142845853 posted

    Trying to understand how a WebForms project can have an external .DLL to manage custom web pages?  Initially I have this project in webforms where one of the pages has the # symbol in the address?  localhost:35000/idm#/  and then suddenly its running from that .dll?  Where is the interface in the project?  How to find what data is shared or accepted? 

    Is there any way to put a debugger on it?  so lets say this .dll lives at  filename/bin/4.5/debug/thefile.dll   

    Even if debug isnt possible, the dll is not working right, cannot even see where the code leaves the webform project and when the .dll gets it.  Am not sure if its using MSAjax?  but how does a webforms app interact with a .dll reference?  thanks

    Monday, January 14, 2019 7:03 PM

All replies

  • User475983607 posted

    Trying to understand how a WebForms project can have an external .DLL to manage custom web pages?  Initially I have this project in webforms where one of the pages has the # symbol in the address?  localhost:35000/idm#/  and then suddenly its running from that .dll?  Where is the interface in the project?  How to find what data is shared or accepted? 

    Is there any way to put a debugger on it?  so lets say this .dll lives at  filename/bin/4.5/debug/thefile.dll   

    Even if debug isnt possible, the dll is not working right, cannot even see where the code leaves the webform project and when the .dll gets it.  Am not sure if its using MSAjax?  but how does a webforms app interact with a .dll reference?  thanks

    Your question makes little sense.

    My best guess is you are asking how to debug a dll within your project.  It's possible but the assembly had to be built in debug mode and the .pdb file must exist in the bin folder. The *.pdb file contains the debugging symbols Visual Studio uses to interface with the running assembly.

    Other than that, you might be making an assumption.  The hash in a URL means bookmark.  A link on the current page.  It's common to find a link with the following configuration...

    <a href="#" onclick="doJavaScript()">Execute some JavaScript</a>

    Clicking the link will append the # to the end of the URL if the default click action is not disabled.

    Monday, January 14, 2019 7:51 PM
  • User2142845853 posted

    Yes I apologize, the question is not well worded.  Im trying to understand the underlying technology as opposed to asking about the specific code im trying to figure out. 

    Here is a webforms app. When you run it, and you put the URL as something like localhost:3598/idm/#/  now its running some part of the code, showing a page that has no associated .aspx or .cshtml file that exists in the Solution explorer, 

     public partial class Startup {
            public void Configuration(IAppBuilder app) {
                ConfigureAuth(app);
                app.Map("/idm", idm =>
                 {
                     var factory = new IdentityManagerServiceFactory();
                     factory.IdentityManagerService = new Registration<IIdentityManagerService, ApplicationIdentityManagerService>();
                     factory.Register(new Registration<ApplicationUserManager>());
                     factory.Register(new Registration<ApplicationUserStore>());
                     factory.Register(new Registration<ApplicationRoleManager>());
                     factory.Register(new Registration<ApplicationRoleStore>());
                     factory.Register(new Registration<ApplicationDbContext>());
                     idm.UseIdentityManager(new IdentityManagerOptions {
                         Factory = factory ,
                         SecurityConfiguration = new HostSecurityConfiguration()
                         {
                             HostAuthenticationType = ConfigurationManager.AppSettings["Cookies"],
                             NameClaimType = "name",
                             RoleClaimType = "role",
                             AdminRoleName = "admin"
                         }
                     });
                 });
            }
        }

    So here is where the /idm comes from, add the /# and now the page is served up from .dll files not from any source code in the project.  I seemed to have missed this somewhere, the .dll called literally IdentityManager is supposed to be fed parameters and it runs, but where do they come from in the webforms project? at what point?

    So how in general is some other .dll file/project built and then added as a reference project and then called? Whats the format to register it and then make use of it? whats it even called?

    Monday, January 14, 2019 8:37 PM
  • User475983607 posted

    The code shown is a way to configure a second HTTP pipeline where the path starts with /idm.

    I recommend asking the service owners the specifics.

    https://github.com/IdentityManager

    Or visiting the Wiki.

    https://github.com/IdentityManager/IdentityManager/wiki/Architecture

    According to the docs and source code the HTML exists in the templates folder.  It looks like angular.

    https://github.com/IdentityManager/IdentityManager/blob/master/source/Core/Api/Controllers/PageController.cs

    https://github.com/IdentityManager/IdentityManager/tree/master/source/Core/Assets/Templates

    Monday, January 14, 2019 9:30 PM
  • User2142845853 posted

    2nd http pipeline? ok will look into that.  but this package is OWIN middleware, its made to fit in with existing software packages.  Im trying to understand how the structure was created.  there is this package that you point to, its compiled in VS2017 then theres a build script that creates the output file, which then can to into nuget or drop in to your VS2015 webforms project that has IdentityManager and its Manager.asp associated file installed.  Its angular.  I changed some of the user interface parts compiled and dropped into my project.   If I dont initialize some parameters right in my webforms project the pre compiled vs2017 package reports the error including the literal code path in there.

    Having this portable code is interesting and Id like to find out how its done, how it interfaces, what the interface point even is??  Ive asked the folks there, they said read the wiki which I did, and the videos which I did, follow along, the first part works.  But now? its saying if you want identitymanager to be put behind authentication you have to run the identityserver and set that up.  well this part flat will not work.  The instruction said put this initialization code in your Scope Store.   Scope Store?? Ive never even heard that term before.  

    Scope

    First of all we’ll add a custom scope for accessing Identity Manager and at the same time ensure it always receives the scopes it needs. Add the following Scope entity to your scope store:

    new Scope {
        Name = "identity_manager",
        DisplayName = "Identity Manager",
     	Description = "Authorization for Identity Manager",
        Type = ScopeType.Identity,
        Claims = new List<ScopeClaim> {
            new ScopeClaim(Constants.ClaimTypes.Name),
            new ScopeClaim(Constants.ClaimTypes.Role)
        }
    }

    So what we have is an addition to Im guessing some class called scopestore?  There of course is no such class anywhere to be found, not even an example.  The code is apparently sent by some mechanism I cannot find, over to this external .dll that we compile in VS2017 and drop in to the VS2015 folder.  It tells the identitymanager along with more code for setting up a Claim, about some.... ??  total mystery.

    Asked them what a scope store is, it could be the next step since I got part of it running and now need to put my code behind folders with the web.config in each one showing what roles and who can access the folder.  The problem?  identitymanager either runs open, or you have to assign a default admin who can then add users or other admins.

    The way it is now, I cannot put identitymanager, the mystery code from the precompiled .dll, behind any authorization role as its not in my VS2015 code, only some initialization code that is sent to it.  if I make a folder called /idm in my VS2015 project and add web.config saying deny = "*" and authorize = "admin" and have externalhost config setup, it refuses everything, it has no idea about /idm in the local folder in vs2015, thats a virtual path its mapped to.  /idm/#/  runs the mystery .dll and its given or accepts the initialization script including apparently Scope and Client folders or stores, which have no explanation.

    I hoped if I sought to understand how a VS2015 project can add some precompiled .dll and send/receive from it, it may explain how to get this one working, 

    thanks

    The code shown is a way to configure a second HTTP pipeline where the path starts with /idm.

    I recommend asking the service owners the specifics.

    https://github.com/IdentityManager

    Or visiting the Wiki.

    https://github.com/IdentityManager/IdentityManager/wiki/Architecture

    According to the docs and source code the HTML exists in the templates folder.  It looks like angular.

    https://github.com/IdentityManager/IdentityManager/blob/master/source/Core/Api/Controllers/PageController.cs

    https://github.com/IdentityManager/IdentityManager/tree/master/source/Core/Assets/Templates

    Tuesday, January 15, 2019 5:17 PM
  • User475983607 posted

    IMHO, you should drop this approach.  1) the code is no longer supported 2) you are guessing how the project works.

    IIRC, all you're doing is building a simple interface to assign roles to user.  Myself and another forum member already wrote this code for you in another thread.

    Tuesday, January 15, 2019 6:17 PM
  • User2142845853 posted

    my timeline was if I got this add in "working" in that I could modify the UI before I got any other reply, Id try to go with it.  I dont like not knowing how it works, so part of this is about how you add in some .dll and configure it in the code? and part of it was that it was 99% working.  oh, up to the point of putting it behind some authentication scheme. It cannot be something that I just hide the tool until the right user logs in because you just type /idm/# and it freely gives you access.  

    ok thought this was the last step. just put in the identity server now and setup the admin user. last step is so obscure nobody has heard of a scope and a client class.  was supposed to have it done then go enjoy Christmas.  That didnt happen.  

    I feel stupid not knowing how the thing works or what the technology is called, its owin middleware and am guessing how it works, was hoping someone here could fill in the details.  yes you dont know how many times I wanted to give up on this identitymanager 1.0 thing and go with the sure thing that you guys posted, which I marked as the answer and, which perhaps, one step from the finish line will have to go do.  So guess will finish out today, then give up and admit total defeat and implement the manual approach

    the group who made it supports the newer version, hoped for an answer on some things before now.

    IMHO, you should drop this approach.  1) the code is no longer supported 2) you are guessing how the project works.

    IIRC, all you're doing is building a simple interface to assign roles to user.  Myself and another forum member already wrote this code for you in another thread.

    Tuesday, January 15, 2019 8:42 PM
  • User475983607 posted

    I would go with a later version of Identity server if that's your goal but keep in mind that IdentityServer is a centralized OAuth service.  I user IdentityServer4 and very happy with it.  ASP.NET Core 3.0 will integrate IdentityServer in the new templates.   IMO, it is a good thing to understand.

    Tuesday, January 15, 2019 11:33 PM
  • User2142845853 posted

    Yes, got a note back about using a newer version.  Had solved the scope/client but the reference example would not compile because it needed an object reference.. Will try it one more time.

    When it says asp.net CORE, the first thing I think of is the usual, standard everyday asp.net thats been in use all these years.  Turns out the word CORE means some next generation new, different totally unheard of new project/direction asp.net is going.  Why didnt they call it asp.net next generation  or have asp.net NEW something or other in the name.  

    I saw how the identityserver/manager newer versions compile under asp.net CORE.  I found out no, they dont at least not the asp.net webforms v 4.5 4.6 4.7 or 4.72 the newest I could find.  No, asp.net CORE, not the usual everyday asp.net.  I dont like how they named it and did not let people know its not backwards compatible.  Docs say asp.net CORE can run natively on Linux?  great! Ive wanted to develop in windows to use on linux since 1994 without trying to use WINE in there.

    But Id also like to know the mechanism works to develop a .dll then instantiate it in a project and use it

    Wednesday, January 16, 2019 5:26 PM
  • User475983607 posted

    But Id also like to know the mechanism works to develop a .dll then instantiate it in a project and use it

    Pretty basic.  Add a library project to the the solution that has your web app.  Then reference the library project.  

    Wednesday, January 16, 2019 5:45 PM