Inherited an ASPX site and cannot change a variable - c#

I just inherited an ASPX site from a new customer of mine. I know ASP but I cannot figure this one out. There are two pages that seemingly do exactly the same thing (cause they should) they both read an XML file and pull in the correct child datasets 2010 for the 2010 data and 2011. I need to add a new set for their 2012 line.
I figured I could dupe one of these pages and change the "2011" to "2012." The problem is I cannot find the "2011" ANYWHERE! the only difference between the two files is:
There isn't a "year2011.aspx.cs" to be found via FTP that I can see and changing the 2011 to 2012 just throws an error. Reading up a little on the CodeBehind tag there pointed me to a few DLLs that ARE there BUT I have no idea how to edit them to make them work. Their old developer did not leave anything but what was on the server.
Any ideas on what I can do to make this work?

It seems the code is compiled so there wont be any *.cs files. If you haven't got the source code as you have mentioned you will need to decompile the DLL's to allow you make any necessary edits.
Take a look at http://www.telerik.com/products/decompiler.aspx , it will allow to decompile the dll back to *.cs files to allow you to make any edits.
Once you have the source code you should be able to debug and provide more information about the error you are experiencing

Related

In VS 2019 - How to regenerate code-behind and designer files from an existing aspx page

I imported in my project Web c# an aspx page, for example, mypage.aspx, with HTML code. This page is very simple.
All I want is to generate the 2 files (in IDE) aspx.cs and designer.cs (mypage.aspx.cs and mypage.aspx.designer.cs).
I tried "Convert to web project" functionality but it does not work.
Any idea, please?
Of course, I read several solutions on this site but none worked (with vs 2019).
If there is no actual code in the original code-behind file then it's pretty easy to do. Create a new page of the same name. Then just copy and paste the markup from the original, taking care to leave the newly-created page directive as is.
If there was logic in your original code-behind then you're out of luck. You might try decompiling the original DLL and try to re-create the original code that way.

Accessing Umbraco.TypedContentAtRoot() in another assembly

I'm trying to generate an xml sitemap for published Umbraco content. Ideally I'd like to access UmbracoHelper.TypedContentAtRoot() or something similar that gives easy access to published items. I need to access it outside the web solution, inside a supporting assembly where I'm generating xml sitemaps and sitemap index for dynamic content outside the direct control of Umbraco.
Any ideas about the easiest way to go about this? I've tried referencing various Umbraco assemblies and digging into what's readily available but haven't found anything immediately useful yet.
I have stumbled across
UmbracoContext.Current.Application.Services.ContentService.GetRootContent()
but this seems to require a much deeper understanding about how Umbraco content works under the covers in order to drill down to extract published content for me to index.
Can anyone point me in the right direction? Thanks in advance!
Assuming the DLL you are creating is going to be using IN the umbraco site, you will be able to access UmbracoContent.Current in your classes, as long as you've got a reference to the Umbraco.Core package, as Mivaweb states.
If on the other hand you want to access the UmbracoContext from a completely unrelated external application (say an executable file), then that it MUCH harder to do. A few people have got it sort of working, but it's a bit flakey. Usually in this case, you're better off adding some kind of WebAPI controller action that you can call via HTTP from your executable file, so you have full access to Umbraco on the site.
Update:
If you just want to access the typed content, you can get at it by using:
UmbracoContext.Current.ContentCache
This will allow you to do stuff like:
UmbracoContext.Current.ContentCache.GetAtRoot();
Which will get you all of the root content of the cache.
If you have a seperated project where you would like to do Umbraco stuff then go to the nuget package manager and install Umbraco.Core.
This will install only the necessary Umbraco dll's that you then can use.
Then you just need to include the namespace and you are ready to go.

visual studio does not apply css

I wanted to make a small test site using the Metro UI framework (http://metroui.org.ua/)
So, I started up my newly installed Visual Studio 2013 and started a "new website". I added the neccesary css and js and made a very basic masterpage and default.aspx. But here comes the problem: the css does get loaded, but it doesn't get applied. Not in FireFox, not in IE, not in Chrome and not in the "Page Inspector".
It's quite weird, because in my previous VS2012 this same workflow for testing and experimenting with a framework just worked. I really can't find the problem. Maybe it has to do with my new Windows 8.1, my new Visual Basic 2013, maybe an programming error (although that would be very unlikely, since I checked everything).
I also tried installing the framework using NuGet instead of manually adding it. Same result: it does load, but it doesn't get applied.
Anyone knows what's happening here?
Thanks in advance!
According to MetroUI you have to follow 5 simple steps
Create page with HTML5 DOCTYPE
2.Include metro-bootstrap.css
Include metro.min.js (jquery.js required)
Create main container with class .metro
Use markup, as described in the pages of this site
In your posted images I can't find a container with class .metro . I'd really check the sample code from the posted page.
In case I misunderstood anything please let me know!

Codebehind file doesn't recognize aspx-controls

I was given a webproject written with aspx/c#. When I loaded it into Visual Studio 2010, I got many error telling me that some controls in the code-behind files do not exist in the current context.
I checked for the common pitfalls, like wrong code-behind file name, missing runat-attribute, restart VS, reload project, yet nothing resolves the error.
What else can I do to check where the problem is?
Try to change the code-behinde to CodeFile="where code locate", then it probably will work.
inherit class for the markup file and code behind file should match ,and also make sure if these controls are not third party and may need referencing their dlls or something .If these controls are user controls(ascx) controls , make sure they are using the correct tagname in the register line at the top .
Cudos to #03Usr the following link brought the answer:
ASP.NET controls cannot be referenced in code-behind in Visual Studio 2008
Deleting all designer files and converting the project als web application brought the designer files back, effectively making the controls referenceable again.
This is a really annoying hack but if you delete the control from the aspx page and then save the page, then paste the control back onto the page and save again the code behind then seems to recognize the control. I keep running into this problem whenever I change an attribute like the ID.
In my case, the aspx file was inside a folder named XYZ, and the class name was ABC. So ASP named the C# file's class name as XYZ_ABC
After renaming the file to ABC, the error was fixed
Hope it helps!

NavisWorks API Issue

Has anyone dealt with the Autodesk NavisWorks Manage API before? I have some problems with using this API and I posted on 4 NAvisWorks forums, no one still answered. I also sent an email to the AutoDesk office in Africa but they did not reply. Well here are my problems:
I want to be able to read from a NavisWorks File (.nwd or .nwf) and get required data such as the dimensions of every model in the file, their positions, vertices etc.
to able to change the data (for ex, a rectangle with length 4 and with 5 to a rectange with length 6 and with 2)
to be able to write back the changes to the file and of-course display the changes instantly in the viewer.
I looked at almost every bit of the API documentation but cant seem to see the possibility to achieve what's required (maybe its not possible I am not sure). Any help will be greatly appreciated. Thanks in advance.
P.S. I am working with C#
in API folder where Navisworks is installed, you can find a lot of examples and API documentation.
And the answers:
I believe you can not change geometry, but in order to get it, the best approach is to debug a plugin and investigate what you can get from the object...
Also read this article to understand Navisworks file types.
If you would like to change property value (PropertyCategories), no problem, but again - no way to change geometry. You need to change original file (DWG, ...) and import it in Navisworks once again.
Both of the above.
using Autodesk.Navisworks.Api.Interop.ComApi;
When using this you can access the full geometry of the object and make your amendments here. There are examples of how this is used within the new SDK's. Sadly Navisworks is a read-only application and it would seem impossible to make the changes to the current file. Although you can amend the objects and re-import them.

Categories

Resources