This site is closed for business. I'm tired of cleaning up spam comments and I personally am no longer using DotNetJunkies (I think this was a good idea... but I need better technology for it)... Come visit my blog over at http://codebetter.com/blogs/jay.kimble/.
Bye 4 now,
Jay
I had someone ask me about how to notify their user(s) that their session has ended with a pop-up message today. What I came up with is setting the page you want the user to be notified on (could be multiple) to refresh about 5 seconds after your session timeout value. You then set the Page Load method to check a predetermined session variable (I used "UserId" which I set on a login page) and if it's nothing (it should always be nothing after the session has timed out)register a Javascript startup block which throws an alert notifying the user and then redirects to the default login page. The catch is that if a user directly accesses the page without first logging in (at least in this case), they will get the alert before being redirected to the login page. Feel free to make improvements on this or suggest other possible methods.
-Chris
Today I was asked by a friend about posting the contents of a form to an external site via a specified string format and getting back the result so I thought it would make a good post. This is in VB.NET and as always could probably be improved upon.
Enjoy,
Chris
[Since this site is in need of a few posts. I thought I would go ahead and post some goodies that I've come across]
d.code had a problem last week with Outlook and security. His solution was to use MAPI with .Net (yes, it can be done). He mentions a commercial MAPI component for .Net, but someone in the comments also mentions a free MAPI component for .Net languages. Go Check it out...
Ok, so I installed .Net Framework 1.1 Sp1 on my work computer. Thursday, I went to start testing some changes to one of the web apps I maintain. After some debug effort I discovered an Sp1 bug. I really need a fix.
What's happened is that I use encryption with the RSACryptography provider... I can no longer get an instance of this provider from ASP.Net. I have read some articles that have pointed me to the “c:\Document and Settings\All Users\Application Data\Microsoft\Crypto\RSA\Machine Keys” folder and its permissions. I have reset the permissions for ASPNET, IUSR, and IWAM (with numerous reboots) with no success. Has anyone found a solution to this issue? I have yet to find a solution anywhere.
Jay
Hey I just wanted to let you guys know that I'll be out of commission for a few days (starting a little bit later today), and will be back sometime Tuesday (hopefully), so if you have any questions I won't be able to post them for a few days (unless one of my other helpers wants to take the emails for a bit).
In case you're wondering, I'm moving Sunday/Monday.
Jay
Ok, I (Jay) have a problem that I'm trying to solve. I thought I'd give you guys a chance to solve it before I do (as it is taking longer than I want).
So let me try to explain the issue as best as I can without getting overly complicated (because the problem is a bit complicated).
Background Info
I have an area of my ASP.Net site (at work) that reads data in from another system. In fact I pull a bunch of different types of data from this particular system. each different type of data that is pulled has it's own "import." The "import" is defined in a database table. My app uses the information in the table to determine which stored procs to call, etc. It's all very database-driven. (In case it's not obvious the list of columns is different for each "import.")
One of the things I have to do is present the user with a datagrid (I originally did this in classic ASP) that let's them edit individual rows as well as clear out the data in various fields in the table, because sometimes they don't want to import the data from certain fields (because the data is messed up).
As I'm converting things over I've decided to try to "build a better mousetrap", so I decided to create my own custom boundcolumn that let's me substitute various controls based on the data type (a checkbox for a bit field, a numeric text editor for numbers, etc). I also have special columns that aren't editable (I can tell by the name of the field coming back). By using a custom boundcolumn I can detect when a column should get the "Clear" this column button (also controlled via the field name).
The other issue is that my datagrid starts out with only a Edit/Update/Cancel linkbutton column. I dynamically add the columns to the datagrid (which I find that I have to do this everytime any event fires)
Now the problem
I've got everything working and am now implementing the "clear" button. After my first attempt, I've found that the button isn't firing in my boundcolumn class (which incidently is in a separate support assembly for this part of the site).
The question is simple "how do I get the button click event to fire?" My suspicion is that the fact that the datagrid is not maintaining state is a bad thing... what I'm guessing is that since the datagrid is not "remembering" the state of the columns, so whatever mechanism in ASP.Net that handles events is unaware that my button exists, so it's not able to recognize that I clicked a button on the datagrid and map that click to an event in my boundcolumn class.
[One quick edit (a day later) viewstate IS turned on in the datagrid. The extra bandwidth is not a problem for this particular area. The real problem is that columns are STILL not maintaining state between calls.]
Advice/help would be greatly appreciated (BTW, the "classic" ASP code does all this by dynamicaly building a table... not something I want to do in ASP.Net since I have the datagrid)
I edited all the questions because I've now added a few categories to this blog (which should make it easier to zero in on questions that you think you may be able to answer as well as what you are interested in)
- Jay
Guys,
Love the idea of a QnA blog! Hope it works out.
My question is more of a 'am I doing this the right way' kind of thing. I posted it on my own blog, but got no comments.
I need to retrieve a byte array from a DataRow into a local variable from an untyped dataset. The size of the byte array is known, but apart from the first few columns of the row, the overall structure of the retrieved dataset cannot be assumed - which is why it's untyped.
So, this is how I did it:
...
byte[] currentCalcMask=new byte[50];
currentCalcMask=(byte[])thisRow["calculatedMask"];
...
Assuming we cannot use a typed dataset, is this the best approach? I have to coerce the return value into a byte[]
I have something weird I'm trying to accomplish and was wondering if anyone has tried/accomplished this.
Here's the problem (briefly).
I have some power users of a system that I built that use MS Access as a frontend to SQL Server. They have direct table access. I want to wean them off of this, and would preferably like to give them some stored procs... unfortunately they have some mini apps in MS Access against the data. Beyond me teaching them how to call SQL server via the Jet engine (creating a connection to SQL through a connection/recordset object) is there any way I can hook a .Net assembly into Access that would let me display some dummy tables (or dummy queries) that when called will invoke methods in my .Net assembly (BTW, this is MS Access 2003).
I've been looking through the mess that is MS Access and can't seem to make heads or tails of how I can do this (or even if it is possible).
(See also http://dotnetjunkies.com/WebLog/jkimble/archive/2004/07/26/20375.aspx on my blog)
- Jay
Since I keep getting comments on my blog (this is Jay writing this) from this post - http://dotnetjunkies.com/WebLog/jkimble/archive/2004/06/14/16408.aspx. I thought I would post the question and the answer here (Hey, we're not doing much with this blog yet, so it's the least I can do.
Here's the problem with Office 2003 (that I had) -
1) The Email link in the start menu no longer launches Outlook, but opens the My Documents folder
2) (this is the biggie). At first when I launched Word or Outlook, I would get an installer dialog and it would ask me to locate “511484-excel-GLB.msp” which is not on either my old or new drive. From what I have read it appears to be something from a patch that I applied last month. By canceling on the installer, I could get to the program. (BTW, if I try to run MSOffice setup in any way shape or form, I get this installation message so I can't even do an uninstall). I then read on Saturday about how I could try to do a “Detect and Repair” from the help menu. I did this letting it do everything (reset the settings and icons). After working a bit, this dropped me into a MSInstall which ends up asking for... you guessed it... “511484-excel-GLB.msp.”
This happened when I added a new 200 GB HD to my system (and tranferred the data on the C: drive).
About 1 week later I decided to hack the registry and figured out how to manually de-install Office Patches (which is the problem... there's an office patch that is somehow hung and it can't figure out how to get rid of the patch). While I'm not sure how safe my solution is (so be careful... I instruct you to make .reg files along the way which can be re-imported back into the registry). Here's the followup post that a few people can't seem to find - http://dotnetjunkies.com/WebLog/jkimble/archive/2004/06/22/17277.aspx.
Jay Kimble (The Dev Theologian)
[Here's our first question - Jay]
OK I have a question: I have a WinForms application that I've been working on for a while now, and am completely stuck on this one problem and can't seem to get beyond it. I'm trying to incorporate a TreeView control into the application with the contents of the file system (similar to the TreeView in Windows Explorer, or a file picker dialog) that will allow a user to readily select a file from the file system at any time.
I've gotten it to work to a certain point, but can't seem to get past a significant problem that I've run into with it. Here's what I do: First I build a set of root nodes that represent the available drives on the system using the System.IO.Directory.GetLogicalDrives() method. I create a string array with that method call, and then loop over that array creating nodes for each item in it. Seems to work just find.
Then, I've created event handlers for the AfterSelect and BeforeExpand events where I create child nodes for the selected/expanded node very similarly, by creating string arrays of the folders and files in the selected/expanded folder by calling the GetDirectories() method and the GetFiles() method of the Directory object. Again, I loop over those arrays and create child nodes for each of the items in the array representing each of the subfolders and files for the given node. That too seems to be working fine, with one exception...
I run into problems whenever GetDirectories() method encounters a folder in which I don't have access. The first and best example I have of this is the "System Volume Information" folder. The user that I'm running the application as doesn't have access to that folder, so an exception is raised, and the loop ends, because the method cannot continue building the array with the rest of the folders, of course, because the exception was raised.
So, what I would like to know is, how can I access, or read, look at, whatever...the permissions of each individual folder as I go through the loop, to find out if the user executing the application has access to it or not, and if not, skip it and continue with the rest of the folders. The same thing for files as well. Also, eventually, I will want to be able to check if the file currently being looped over is binary or not (whether or not it's edit-able, the application I'm working on is a text editor) so that I only display files that the user would be able to edit. So basically, I need to be able to access some of the detailed attributes of the files and folders on the file system so that I can determine whether or not they should be available as nodes in my TreeView. So far I haven't been able to find a way to access the information I need to be able to determine if I should create a node for the object or not.
Sorry this was so wordy, but I wanted to make sure that I provided enough information to make it clear what I was trying to do, and the problems I was running into in trying to do so. I *really* hope that someone is able to provide an answer to this question, because I've been trying to figure it out for weeks and haven't been able to figure it out, and my progress on this app has been VERY slow because of it. A solution or at least a point in the right direction would be very much appreciated. Thanks.
Welcome to .Net Q&A
I got this idea a few weeks ago to start a blog that could serve as a way to get questions answered quickly. Since I don't read newsgroups and have had limited --read that as "No"-- success searching the newsgroups, I decided that I need some other avenue. I've noticed on my blog here on .NetJunkies that Google seems to be able to index it well. Google doesn't do a good job of indexing forums. As a result I decided that we should have a blog that simply acts as a way for programmers to (anonymously if they want) post questions and have them answered. Google will in turn index the answers and then other programmers can later find the answers via Google (without, hopefully, going through much pain at all).
A Note to bloggers
If you have a blog, you don't necessarily need to post the answer in the comments here, but simply use your blog to answer the question and make sure that there is a trackback (or some other kind of link from the comments here to your blog). This way Google will index your site as well as this one (and maybe making the answers even easier to find).
Introductions -- the facilitators
I'd like to introduce you to the facilitators of this blog (there are currently 3). I'm Jay Kimble, the Dev. Theologian (don't be scared; it just means that I am working way out of field). My blog can be found here. I live in Florida.
The second person who will be facilitation this is Chris Wallace. His blog can be found here. Chris lives in Georgia.
The last facilitator (for now) is my good friend David Balzer. His blog can be found here. Dave lives in Ohio.
(wow! 3 east coasters! We should probably get someone from a different timezone... Any Aussies interested? I figure Australia is at the opposite side of the earth from us which would mean things might get posted faster that way)
How will it work
This is the easy part. If you have a question you can simply use the Contact link (and fill out the email form) on the side to email a question. Feel free to spell out the problem as best as you feel is ok to do. One of us will (which right now is me as we don't have multiples emails set up... yet) take your question and water it down as best as we can, and then post the question. You can then feel free to anonymously post additional information in the comments (if necessary). The blogging community will see the question (and just like Linux) answer the question even before it's posted... (just kidding).
I can say that I have had good response posing questions on my own blog (and have helped a few people out privately)