C# - Modifying Scriptmaps/handlermappings Programmatically
Mar 22, 2011
I have some code to create a Virtual Directory programmatically.
I need to edit handler mappings of framework 2.0 to use .net 4.0 (basically run .net 2.0 code under .net 4.0 CLR).
The code below works fine under win 2003 server, but on Windows 2008 server webservicefactoryHandler2.0 is renamed as webservicefactoryHandler4.032_1245.
I don't know how to access/edit this name or infact retain the name and just change its value to Microsoft.NETFrameworkv4.0.30319aspnet_isapi.dll from Microsoft.NETFrameworkv2.0.50727aspnet_isapi.dll.
Dim scriptMapVals As PropertyValueCollection = VDir.Properties("ScriptMaps")
Dim objScriptMaps As ArrayList = New ArrayList()
Dim frameworkVersion As String = "4.0.30319"
[Code].....
Update: @kev : So basically you are saying to use different code for different version of IIS right? Well while using import "Microsoft.Web.Administration.dll" , do i need to pack it up in my build ? or this is part of all IIS7.0 installables? as Some poeple could have IIS7.0 on Windows XP.
View 1 Replies
ADVERTISEMENT
Jun 7, 2009
Suppose that one have a reference to a DataTable and it is wanted to manipulate one of its UniqueConstraint objects. How can I:
1) Remove the constraint even if it is the DataTable's Primary Key.
2) Change the column set of the constraint; that is, adding or removing columns or giving a different set of columns.
3) Set the constraint to be the Primary Key of the DataTable.
notice that the UniqueConstraint is already created, so it is wanted to modify it programmatically afterwards.
View 9 Replies
Nov 23, 2009
I have written a VB.NET 2008 application, incorporating Microsoft.Office.Interop.Excel, that modifies an existing Excel 2007 spreadsheet. It works perfectly on my WinXP development computer.When I upload the app to a Microsoft Web Server 2008, it opens the file and reads from the file, but when the app tries to save the file, it throws this exception:"System.Runtime.InteropServices.COMException (0x800A03EC): 'july2009.xlsx' is read-only. To save a copy, click OK, then give the workbook a new name in the Save As dialog box."The file is NOT read-only, nor is it opened by any other user or app.The app and the Excel file both reside on the D: (data-only) drive.My first instinct was to look at file permissions. When nothing else worked, I literally created a temporary Group, added EVERY user and security entity to it and granted the group full control of the entire D: drive. No luck.
Then I tried manually elevating the permission by running my app as administrator. No luck.Finally, I copied the file to my XP development computer and ran the app there. Of course it worked perfectly.Can anyone please tell me how to give my program permission to edit a file on Server 2008?
View 3 Replies
Mar 16, 2011
Locality Not repeating code..Modifying program means modifying one aspects.
View 11 Replies
Dec 3, 2009
I have a core EXE I wrote to serve a series of purposes. Another editor that goes along with it needs to repackage that EXE along with the script that EXE interprets. That is simple enough.
However, I need to give users of this stuff the ability to give that repackaged EXE an icon of their own choosing, but they do not have the source code to manually compile that EXE.
I know some magic with file streams and binary manipulation could do this, but I have the sinking feeling that that's pointlessly doing this the hard way and there may be a better way. Maybe the EXE itself can reset its own app icon per instructions given to it.
View 3 Replies
Aug 28, 2011
I use this code to delete rows from dgv but what about modifying
View 1 Replies
Aug 23, 2011
I found a CSS file while I was searching for how to create tabs without using images. I came across CSS Tabs 2.0. which serves my purpose.However, now I need to customize it to fit my asp.net page, and I can't seem to be able to get anywhere.The CSS file uses a
<ul and an <li
I am using a Table with <tr> and <td>
This is the sample code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">[code]......
View 1 Replies
Jan 11, 2010
I have to convert this as stated. I am trying to retrive the next position line in an .txt file based upon a user's integer.Basically retrive the next .txt line from user input to an lbldisplay.
Option Explicit On
Option Strict On
Option Infer Off
Public Class frmMain
[code]....
View 2 Replies
May 7, 2012
since upgrading from 2008 to 2010 i have seen an issue where i pause my vb.net project,modify some code, resume, but the app does not execute the new code, it continues as if nohthing was changedery strange, very frustrating
for example
msgbox("1")
if i pause my app and change this to
[code].....
View 16 Replies
Mar 1, 2012
I am populating data form database in combobox. This data is in the form of numeric codes like 112, 113,
The thing i want to do is on selecting some code like 113 from combobox, it will display it as ABC113 in the combobox.if code like 114 selected from combobox, it will display it as ABC114 in the combobox.
I don't want to store this modified string in database.
Please help me to achieve this.
Provide me some sample code or link for simple combobox or combobox in datagrid.
i think there is no change in code in both above cases.
View 7 Replies
Sep 25, 2009
I have a ComboBox that is bound to a List(of T).Now I type-cast the ComboBox.DataSource into List(of T)and add some more elements in the List.The items collection of the ComboBox doesnt get reflected and the new element does not show up in the ComboBox. Am I missing something ?
View 3 Replies
Sep 1, 2011
I've got to do some special things with a RichTextBox. I have to add syntax highlighting and I need
to be able to find out what character was added/removed/inserted at what position every time a key
is pressed. Is there some way to edit the existing, or is there a open source (.net compatible,
preferably VB.net) available for download? I've tried making my own, the problem is, it has to have
every function normally available and I don't have enough time to implement all of that.
View 1 Replies
May 26, 2011
I am trying to add a parameter to the deleting event of an ObjectDataSource as in the example below from msdn. I generated an event handler for the ObjectDataSource's deleting event, and it had the same signature as in the example, however, when I try to clear the paramsFromPage as in the example, I receive an error stating that
View 1 Replies
Aug 9, 2011
Why does QueryBuilder modify my query? Is there a workaround? When I enter the query below, QueryBuilder modifies the query to the more complex version below, requiring additional parameters for the FillBy method. Any additional parameters adds an exponential amount of complexity to the modified query.
[Code]...
View 1 Replies
Aug 16, 2011
I am modifying an existing application in VB .NET. In one routine, I have added a reference to a class in a newly-referenced class library project that is part of my solution, and now I get run-time FileNotFoundException messages when the program attempts to access this routine while debugging. The error tells me that the class can't be found, what's up with that?
To be clear: If I remove the lines of code relating to the new class, I no longer receive the exception messages. If I add them back in, here they come again! I have referenced the class library in the project containing this routine. The class library is building properly (other projects reference same library, and use it more extensively), and the project is referencing the class library's .dll file in my "debug" folder. I get no errors from other routines that use this new class (thus far). I get no errors in the Error List of the IDE.
View 1 Replies
Oct 29, 2009
I have built an app in VB2008 that uses an Access database (accdb).I need to add some fields to some tables.
View 4 Replies
Nov 5, 2011
I'm testing the code below from another author, which works well for reading in the data. Despite this, once the data is populated I also need the DataGrid to be able to accept and delete data too. Is it possible to modify the code for this? I tried several things (in properties too) but am not sure if it is possible in this example.
Dim statesXml As XElement = _
<states>
<state name="California">
<abbreviation>CA</abbreviation>
<year>1850</year>
[Code] .....
View 5 Replies
Sep 9, 2010
I'm trying to access a database (SQL Server 2008 express) using Visual Basic 2010 Express. First I got a permission error that was solved modifying the Database permissions. Now I get a new error message "This file is in use. Enter a new name .." I already have changed the Autoclose propertie to true, and also tried detaching the Database.
I'm using Windows Vista Home Premium, my string:
Data Source=.SQLEXPRESS;AttachDbFilename="C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQL10MSSQLDATAemplo1.mdf";
Integrated Security=True;
Connect Timeout=30;
User Instance=True
View 13 Replies
Jun 18, 2010
I have a gridview and when a user selects a row I want to change the view in my multiview and display several new gridviews. A user would be clicking on a computer, and then it will display the computer stats/atached devices/etc. The new gridviews are going to need a column from the row that was selected, how do I get that?
View 1 Replies
Jan 31, 2010
i'm working on a program and i'm working with panels, and i'm very frustrated because I want to bring a panel to the front of the form but because of its parent it is locked into another panel.... in the properties for the panels there is no Parent container option though the only way i know how to modify parents is during runtime like this Panel1.parent = Me
View 3 Replies
Jan 25, 2012
reading and modifying data from database
View 4 Replies
Sep 3, 2009
I have a dataset bound to a DGV thus:
Me.BudgetTypesTableAdapter.Fill(Me.RestelDataSet.BudgetTypes)
When I save new data I use :
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Me.Validate()
[Code].....
should work as the Rowstate is checked to see what should happen ie (UPDATE, MODIFY OR DELETE).
View 3 Replies
Jan 6, 2010
I've got several methods that all need to add items to a single list which will eventually be used to populate a listview. I thought about declaring the list at class level so that all of these methods could access it, but it didnt really make sense as the only methods that access this list are Shared methods, so I didnt think it was worth having a list just sat there for the entire time that any instances of the class are created, when in a lot of cases the list would not be used.
So what I ended up doing was just declaring the list in the Shared method that then calls these other methods that need to add to the list, and for each of these methods it calls it passes the list in as an argument. The methods can then add items to the list and as the list is a reference type it updates the underlying list object, so once all of the methods have been called then the list in the calling method is up to date and can be used. Then when that method exits, the list is no longer in scope and so is removed from memory. This all works fine, but it feels a bit... wrong. Would it be better to just declare the list at Class level and not be bothered about the small overhead of the list always being in scope when instances of this class are created that will not even use the list?
EDIT: Actually, thinking about it.. because the methods that use the list are shared then the list would need to be shared as well if it was at class level - so the list would not only be around when instances of the class are created, but all of the time. So it will just be sat in memory for the lifetime of the program wont it? I assume this could make a noticeable impact on memory usage after the list has been filled with data, so I guess if I went down that route then I would have to make sure I cleared the list once I had populated the listview. This is another reason why it just seems much easier and more manageable to declare the list as a local variable in the shared method that then calls the other methods that also add to the list.
View 3 Replies
May 17, 2011
So one of my programs logged an error the other day that I am trying to fix. The error was Collection was modified; enumeration operation may not execute.To overly simplify my code, users can add or delete objects from the collection at runtime. In the background, on a separate thread, a process runs every so many seconds that syncs the data in the collection with the data in a flat file.
To avoid my problem, it seems the most logical to create a COPY of the collection at the start of my second thread's procedure, and run off of that.How do I do that?If I try to say something like.
[Code]...
View 4 Replies
Jun 4, 2011
I'm currently developing an app with multiple forms, is there a way to modify a common property for several forms at the same time?
View 7 Replies
May 8, 2012
I'd like to start off by saying I'm not really a programmer just a sysadmin who likes to dabble (so simple answers would be nice ;) ),I've created a webapp that's used by some less technical folk to do basic administration tasks(User provisioning through our IDM, Updating passwords, Disabling accounts, Editing user details, etc)there's also a couple of exchange functions that are currently handled by exporting a CSV that a separate powershell script processes.I'm trying to bring these powershell functions into the application to reduce complexity but I'm having some trouble.
When I execute the "Add-MailboxPermission" command I get no return output (nor does it apply the change) at all, unless I put no parameters,in which case it throws the expected missing parameters exception (Not scientific but proves it's loading the exchange plugin fine and executing):
private sub cmdMbxFullAccess(sender as object, e as eventargs)
Dim psRunSpaceConf As RunspaceConfiguration = RunspaceConfiguration.Create()
Dim psConfException As PSSnapInException[code].....
If however I issue a simpler command like "Get-Host | Out-String" I get return output as expected. Thus far I have checked that the user context it's running under has the correct permissions and tried executing the command from the powershell prompt on that server to make sure that there isn't some other external issue I am overlooking.how I can further debug this, it's like the command disappears into the ether never to be heard from again!
View 2 Replies
Jun 21, 2011
How do I modify or create my own Html.ActionLink helper to accept and handle the first parameter (linkText) passed in as an empty string / nothing?Details: I currently have a strongly typed view that's passed a model which contains search results. My view loops through each item in the model and attempts to display a link to a contact with the following code:
@Html.ActionLink(currentItem.ContactName, "contact", "details", New With { .id = currentItem.ContactID }, Nothing)
Normally this would work just fine, but not every item in my search result has a ContactName. The Html.ActionLink helper errors when this first parameter is empty. In case it helps, here's the model property for ContactName (which is generated from a template due to Database First, so I don't believe it can be modified):
Public Property ContactName As String
I'd like to have a helper function that simply returns nothing if the ContactName is an empty string / nothing.I'm guessing I need to extend this helper, and I've struggled to find any good, up-to-date resources in VB.net for extending helper functions. Other approaches are more than welcome if they're considered best practice. I'm working in VB.net, MVC3, and Razor in the ASP.net 4.0 framework.
View 2 Replies
May 8, 2012
I'd like to start off by saying I'm not really a programmer just a sysadmin who likes to dabble (so simple answers would be nice ;) ), I've created a webapp that's used by some less technical folk to do basic administration tasks (User provisioning through our IDM, Updating passwords, Disabling accounts, Editing user details, etc) there's also a couple of exchange functions that are currently handled by exporting a CSV that a separate powershell script processes. I'm trying to bring these powershell functions into the application to reduce complexity but I'm having some trouble.
When I execute the "Add-MailboxPermission" command I get no return output (nor does it apply the change) at all, unless I put no parameters, in which case it throws the expected missing parameters exception (Not scientific but proves it's loading the exchange plugin fine and trying to execute):
[Code]...
View 1 Replies
Jun 17, 2009
From my initial readings on unit testing it is wise to put all of your setups and tests in a separate project from the code being tested.I've recently begun reading The Art of Unit Testing, trying to discover how to break dependencies on things such as database calls.The methods offered involve changing areas of the test code, such as adding specific interfaces and "stub" methods to the production code.This seems to defeat some of the good things about keeping tests and production code separate.Is there any recommended dependency-breaking technique that doesn't involve changing production code?
View 3 Replies
Mar 31, 2011
I need a function to be performed on the page load, which uses a stored session variable. I have added the following to my <body> tag.
<body onload="doSomething(event,'<%= Session("StartTime") %>')>
This does work. However, it is causing a problem elsewhere, when I try to add a control to my controls collection:
[Code]....
View 2 Replies