SEARCH YOUR SOLUTION HERE  

File Security and Aspx pages Httphandler

I have this scenario :-
userid 66 has folder/66
userid 75 has a folder/75
do not want 66 to be able to access 75's files by changeing url.

After logging in, the user has an aspx page has a list of hyperlinks to different files Example(http://comm/66/test.doc)
I do not want them to be able to change the url to http://comm/75/test.doc which would be for another user.
aspx pages are protected but doc,pdf,txt files are not.
I created a custom httphandler but keep getting an "Unrecognized configuration section 'HttpHandlers'" Error with it.

I Would ask for any suggestions as to how to secure these files.I will paste my code if anyone is willing to help me.

Posted On: Tuesday 1st of January 2013 09:58:51 PM Total Views:  204
View Complete with Replies




Related Messages:

Forms Authentication   (256 Views)
I have the following stored procedure to authenticate users on my website:CODEUSE [keystrategy]GO/****** Object: StoredProcedure [dbo].[DBAuthenticate] Script Date: 03/01/2012 11:46:49 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE PROCEDURE [dbo].[DBAuthenticate](@Username nvarchar(50),@Password nvarchar (10))ASDECLARE @ID INTDECLARE @ActualPassword nvarchar(10)SELECT@ID = IdentityCol,@ActualPassword = PasswordFROM dbo.BabysittersWHERE EmailAddress = @UsernameIF @ID IS NOT NULLIF @Password = @ActualPasswordRETURN @ID ELSERETURN - 2 ELSERETURN - 1This authenticates against the babysitters table. However, I have parents who can login as well and their details are stored in a different table. Can i authenticate against two tables. So it checks the first table, then the second.This is my code for the login button:CODEProtected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click If IsValid Then If DBAuthenticate(txtUsername.Text, txtPassword.Text) > 0 Then FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, False) Session("User") = txtUsername.Text Response.Redirect("secure/home.aspx") End If End If End Sub Function DBAuthenticate(ByVal strUsername As String, ByVal strPassword As String) As Integer Dim conUsers As SqlConnection Dim strConnection As String Dim cmdSelect As SqlCommand Dim parmReturnValue As SqlParameter Dim intResult As Integer strConnection = ConfigurationManager.ConnectionStrings("KeyStrategyConnectionString").ConnectionString conUsers = New SqlConnection(strConnection) cmdSelect = New SqlCommand("DBAuthenticate", conUsers) cmdSelect.CommandType = CommandType.StoredProcedure parmReturnValue = cmdSelect.Parameters.Add("RETURN_VALUE", SqlDbType.Int) parmReturnValue.Direction = ParameterDirection.ReturnValue cmdSelect.Parameters.AddWithValue("@username", strUsername) cmdSelect.Parameters.AddWithValue("@password", strPassword) conUsers.Open() cmdSelect.ExecuteNonQuery() intResult = cmdSelect.Parameters("RETURN_VALUE").Value conUsers.Close() If intResult < 0 Then If intResult = -1 Then lblMessage.Text = "Username not found!" Else lblMessage.Text = "Invalid Password!" End If End If Return intResult End Function
Insert or Update SQL Table when Textbox is Empty   (450 Views)
I have a web form which has around 30 or so fields, most of which are optional from an SQL standpoint (i.e. table column allows Null). I'm using a dataset and table adapter to generate my Insert and Update. Most of the fields are strings, but there are also Dates and Integers.What I'm running up against is that Date and Integer fields that are left blank on the web form crash the Insert and Update commands because a blank string can't be converted to a Date or Integer. What needs to happen is that the database just gets a Null inserted into that field. Is there a simple way to do that when a field is left blank My Insert is below ...
Abort page execution   (230 Views)
i'm trying a code to update a html div using ActiveX or XMLHttpRequest from client side and a asp.net page that retrieve data. The asp.net page is a loop for some seconds and then i do it again the request.My javascript from client side is like this:function Tracking(U,M,V){ var a=window.ActiveXObjectnew window.ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest; try{a.open(M,U,true);a.send(V);}catch(c){a=null;alert('Exception: '+c);}return a;}var MyRequest=Tracking('async/mypage.aspx_r'+(Math.random()*999).toString(),'get',null);function Abort(){MyRequest.abort();}function ViewRequest(){ /* Some code MyRequest.responseText .... */}And the server side: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim StartDate As Date = Now While Now.Subtract(StartDate).Seconds < 15 ' Response.Write (something).... Response.Flush() Response.Clear() System.Threading.Thread.Sleep(50) End While End SubNow, when i try abort the page request by client side, i call the function Abort and the request is stopped but mypage.aspx still in execution to complete the operation for some seconds. How i do it to stop the execution before 15 seconds by client scriptany idea on how I can do thi
Change Root dir to dynamic MapPath   (242 Views)
all,I'm not a dotnet user and I'm having a problem changing a root file location to MapPath type from this code I foundCODEFile DownloadSub Page_Load(sender As Object, e As EventArgs) Dim root As String = "C:\temp\" Dim files() As String = Directory.GetFiles(root) Dim sb As New StringBuilder(2048) Dim f As String For Each f In files Dim filename As String = Path.GetFileName(f) sb.Append("").Append(filename).Append("") Next fileList.Text = sb.ToString()End SubI don't know where to edit/change the C:// to something more dynamic since I'll need this for server host purposes
Email Error:-Could not access 'CDO.Message' object   (226 Views)
,We are using CDO object for smtp server to send emails.One of my customer getting email error such as Could not access 'CDO.Message' object. What could be the reason if 'To' list, 'From' list and other coding stuff is ok Is it related to some configuration on smtp serverIt's urgent
Conflicts of two buttons in one page   (177 Views)
I am using ASP.net 2.0. There are two buttons in a page - Page 1. One button - Button A - does a postback and refreshes a gridview in that page. The other - Button B - makes a cross-page post back to another page - Page 2.Here is the conflict. After I get to Page 2, I click "Back" button on the browser to go back to Page 1. (I do not want to refresh Page 1 so my entries in Page 1 can be preserved.) Then I click Button A. Instead of refreshing the gridview, I am led to Page 2 as if I clicked on Button B.I figured, when I clicked on Button B the first time, a hidden field in Page 1 was written (by javascript generated by ASP.net). This way the server knows that the post back is for another page. That hidden field was not cleared when I went back to Page 1 and clicked Button A.My idea to go around this is to make the Button A as cross-page post-back to itself. However, I need to add some codes so entries in Page 1 can be preserved during this cross-page postback.Any better ideaSeaport
Funnel all requests through one file ???   (214 Views)
Using Helicon's ISAPI Rewrite tool I want to filter all *.prod.myhost.com requests to propertyalpha1.prod.myhost.com.The next rule set I want is to translate (*.)\.(*.)\.(*.) to the wame url, grabbing parameters. So to begin with, the subdomain issue:Using the RegExp Test Utility, I created the following expression which gives me what I need, however I'm unable to apply it as a rewrite rule:Given this URL: propertyalpha2.prod.myhost.com/default.aspxp1=333&p2=4444And this regexp:CODE^((.*)\.prod\.myhost\.com)/(.*\..*)\(.*)$Returns:$1: propertyalpha2.prod.myhost.com$2: propertyalpha2$3: default.aspx$4: p1=333&p2=4444So this should be formatted as:CODEhttp://propertyalpha1.prod.myhost.com/default.aspxsiteID=$1&filename=$3¶meters=$4 In C# I've got the following to return the resultsCODE siteid1 = Request.QueryString["siteid"]; filename1 = Request.QueryString["filename"]; parameters1 = Request.QueryString["parameters"]; Response.Write ("siteid: " + siteid1 + "filename: " + filename1 + ""); Response.Write("Original URL: " + Request.ServerVariables["HTTP_X_REWRITE_URL"] + "");So technically it should work, but not getting the right config in Helicon's httpd.ini.Of course this isn't the only way to accomplish what I'm trying to do, so any other suggestions or assistance would be appreciated
Getting a dropdownvalue for other dropdownlist in a editable datalist   (229 Views)
I'm trying to get a value from a dropdownlist(ddl1) to use as a parameter in another dropdownlist(ddl2), in same editable datalist.Code behind:Private Sub dlClient_EditCommand(...)PopulateDropDownList2()dlInfogen.EditItemIndex = e.Item.ItemIndexgetClients()End SubSub PopulateDropDownList2()Dim TempList2 As DropDonwlist = CType(FindControl("ddl1"), DropDownList)Dim Temval as string = TempList2.SelectedItem.Value Dim dataAdapter2 As SqlDataAdapter dataAdapter2 = New SqlDataAdapter("GetLoc", objConn) dataAdapter2.SelectCommand.CommandType = CommandType.StoredProcedure dataAdapter2.SelectCommand.Parameters.Add("@JID", SqlDbType.Int).Value = Temval dataAdapter2.Fill(objDS, "Loc") TempDataView2 = objDS.Tables("Loc").DefaultViewEnd SubMy problem is that I get an error "Object reference not set to an instance of an object.".Semms that I can't get the value from ddl1, using FindControl.Can somebody tell me where I'm wrong
Category Search By ZipCode   (220 Views)
I was given one application to develop where I need to search a particular category by zipcode. I will have is Dropdownlist with the category names and the ZipCode in a text box field. I have to return all the doctors from that zipcode by returning the full details and also the distance. Can anyone help me how to get started on this application. I dont have any database setup with the zipcodes. I have to develop this functionality in asp.net (vb.net) I appreciate your help
No user error when sending emails   (220 Views)
The code in other parts of the program works ok and sends emails, but in one file when it comes to sending the email to the specified email address (when debugging) it gives the error 'no user 'What does this mean and why does it do this when using smtpClient.Send(message) It's not the email address because it sends emails to that address in other files usin the same method call.
Displaying Active Directory on Intranet   (216 Views)
I'm in the process of developing an intranet for the business that I work for. We're looking to publish the active directory of users on the intranet for each branch. What are the steps needed to do thi
AJAX on server - acts differently on different machines   (206 Views)
I designed a page using AJAX and published it on the server.It looks fine on my machine - I am accessing the page from the server, not a local copy.However, on 3 other PCs, the ajax does not work. The other PCs do not have any unusual javascript restrictions or anything like that. How is this possible
Why is session being shared in Safari and Firefox?   (205 Views)
HiI have come across a problem with a session being shared across 2 browser windows. This is happening in Safari and Firefox but not in IE.To create the problem I do the following:1: Open 2 instances of Firefox2: Login on both instances as the same user3: Go to page that is looking at a specifc row data. For example in 1 instance is looking at product X and the other looking at product Y. This will have set a session variable for each instance to X and Y accordingly.But, the session variable has the value of whichever product I looked at last.Has anybody else had this problemThe code is very simple literally: Session["xyz"] = "12345";CheersRob
Datatable lost edit in datagrid?   (309 Views)
I am having a bit of a logic block. I have a datatable which is being updated. The datatable is then rebound to a gridview.However when I rebind it, the update is lost.I can read the value out of the cell in the datatable, but the grid doesn't see it.Any help is appreciated.CODEDim dt As DataTable = Session("dt")'Read the new value from the gridveiw, then use it to update the datatabledt.Rows(GridView1.SelectedIndex)(4) = CType(GridView1.SelectedRow.Cells(4).Controls(1), TextBox).Textdt.AcceptChanges()Session("dt") = dt'The following shows the updateResponse.Write(dt.Rows(GridView1.SelectedIndex)(4))'Now rebind the grid to the updated datatable GridView1.DataSource = dtGridView1.DataBind()'No change is displayed Rob
Global Classes   (250 Views)
Need to store the details of a user when they login. The old way of doing this would be to create session variables but I believe this is now frowned upon. Ideally creating a global class and somehow implementing this in the global.asax file would be the answer but not sure if this can be done in asp and vb.net.
How to get user properties (specifically group/OU membership) via LDAP?   (167 Views)
I'm working on a site that uses Active Directory for authentication. I want to display certain menu items based on the users' group membership. How do I do this I've tried tons of examples from around the Internet, but nothing is working. I'm guessing that I'm missing something relatively simple and probably has to do with the path that I'm using. As a test, I tried this bit of code to see if I could get the details of a user: CODEPrivate Sub Test() ' Bind to a specific user. Dim path As String path = "LDAP://CN=User Name,CN=users, DC=fabrikam,DC=com" Dim entry As New DirectoryEntry(path) ' Create a DirectorySearcher object. Dim mySearcher As New DirectorySearcher(entry) mySearcher.SearchScope = SearchScope.Base ' Use the FindOne method to find the user object. Dim resEnt As SearchResult = mySearcher.FindOne() Dim propKey As String For Each propKey In resEnt.Properties.PropertyNames ' Display each of the values for the property ' identified by the property name. Dim prop As Object For Each prop In resEnt.Properties(propKey) Debug.Print("{0}:{1}", propKey, [prop].ToString()) Next prop Next propKey End Sub What should the path be if I'm trying to find the group/OU membership for a user named "jdoe" on domain "mydomain.mycompany.com" The user is in an OU off the root named "MyCompany Users". It hought that it would be something like this: CODELDAP://CN=jdoe,CN=MyCompany Users, DC=mydomain, DC=mycompany, DC=com but it doesn't appear to work. Any idea as to what I'm doing wrong
user.identity.name problem   (222 Views)
We have recently renamed a users active directory account and now when user.identity.name callout is used, it returns the old username.It's as if active directory is somehow caching it.Any idea'
Add a footer with a link to the datagrid   (147 Views)
I'd like to add a footer to the datagrid, span all columns in it, and then add a link that would lead to the top of the page. Is it possible to do that Thank you.
Adding an item to a drop down list   (243 Views)
I'm populating a drop down list from a stored procedure and this works great. I want to add 1 more value but I don't want it to default. I tried to populate it in code using add item but I can't figure out which event will let me modify the dropdownlist.
Caching Questions   (186 Views)
,I have a page I built that a FLASH movie that loads and XML data file with a bunch of songs in it. It loads very quickly. The problem I'm seeing is that the Images for the songs are loading each time there is a request. I want to cache them (obviously) or load them all at once. I'm not too familair with caching so I'm looking for some guidance. The images are pulled through from a image processor that resizes them and stuff. Here is the page:http://wisetopic.com/profile/UserId=57Here is what one "Song" looks like (an xml node)CODE Happy Valentines Day! /ImageProc.ashxImage=albm_16_633069117976359969.jpg&width=75&cropHeight=30 SomeMp3.mp3 102 Jenni Quick 5895402 4:05The image proc script is prolly the place to cache the images right I'd like to load them all... what is the best solution to my problem Thank you!!-- Jenni
Quick and Dirty Grouping with a Repeater Control   (344 Views)
Does anyone know of a quick and dirty way to do grouping with a repeater control.ExampleParent Record-Child Record-Child RecordParent Record-Child Record-Child Record-Child RecordI've found some tutorials out there that are way above what I need.Suggestions
How to add second text box when "between" is selected   (189 Views)
,when a user select between clasue from the operatorselector dropdown I would like to add another text box otherwise I have one text box for the rest of the operators. how can I acomplish this. thanksSub OperatorSelector() Dim opSelector As ArrayList opSelector = New ArrayList opSelector.Add("") opSelector.Add(">=") opSelector.Add("Between") opSelector.Insert(0, "--Select Operator--") drOperator.DataSource = opSelector drOperator.DataBind() End Subwill this work for me Protected Sub drOperator_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles drOperator.SelectedIndexChanged If drOperator.SelectedValue.ToString = "Between" Then lblMax.Visible = True txtMax.Visible = True Else End If End Sub
Input string was not in a correct format   (216 Views)
I am using the update feature in a gridview in ASP.NET 2005I am passing parameters to a Stored procedure which seems to work, but when the page is loading up again I get the error Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format.If I close the page and reopen it, it has the new values so it did update.I think my problem might be coming from my DDL and my stored procedure because when I tried to make the value of my ddl Type_ID it crashed everytime so I had to make the text = Type_Name and the value Type_Name then I got the ID in my stored procedure.So I am including my Stored procedureCREATE PROCEDURE DBO.UPDATE_REMARKS -- Add the parameters for the stored procedure here @TICK_ID VARCHAR(25), @DATE VARCHAR(50), @REMARK_TYPE VARCHAR(50), @NOTES VARCHAR(1000) ASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DECLARE @REMARK_ID VARCHAR(50) SET @DATE = (SELECT CONVERT(VARCHAR, CONVERT(DATETIME, @DATE, 101), 101)) SET @REMARK_ID = (SELECT TICK_TYPE_ID FROM TICK_TYPE WHERE TICK_NAME = @REMARK_TYPE) UPDATE TICKS SET TICK_DATE = @DATE, TICK_TYPE_ID = RTRIM(@REMARK_ID), NOTES = @NOTES WHERE TICK_ID = @TICK_ID ENDG
onclick not firing   (152 Views)
I have a button that I have some code in the _Click event that is not firing, I think I am missing something in the InitializeComponent... any ideas Does this even make sense
Creating a desktop shortcut   (206 Views)
Not sure what I need to include to make this work. WshShell.SpecialFolders has the blue line under it stating "Reference to a non-shared member requires an object reference. I added a reference to Microsoft Scripting to the project and I Import IWshRuntimeLibrary.Dim DesktopDir As String = _ CType(WshShell.SpecialFolders.Item("Desktop"), String) Dim shortCut As IWshRuntimeLibrary.IWshShortcut ' short cut files have a .lnk extension shortCut = CType(WshShell.CreateShortcut(DesktopDir & _ "\QPMSOffice.lnk"), _ IWshRuntimeLibrary.IWshShortcut
Crystal Report on the Web   (215 Views)
all,I'm not too familiar with the web controls as I am used to console apps. I'm trying to get a crystal report to print be viewable and printable on the web. I added the Crystal report to the project, then put a crystal report source control on the page and set its report source to my report (via the dropdown list on the web view). I then drop a crystal report viewer control and set its report source to the report source control previously placed. Now I need to pass my report two values dynamically. The code I've been fooling with looks something like this: Dim myTableLogonInfos As TableLogOnInfos = New CrystalDecisions.Shared.TableLogOnInfos() Dim myTableLogonInfo As TableLogOnInfo = New CrystalDecisions.Shared.TableLogOnInfo() Dim myConnectionInfo As ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo() With myConnectionInfo .ServerName = "SQLTest2" .DatabaseName = "AccountsReceivable2" .UserID = "sa" .Password = "pass" End With myTableLogonInfo.ConnectionInfo = myConnectionInfo myTableLogonInfo.TableName = "rpt_Schedules" myTableLogonInfos.Add(myTableLogonInfo) viewerRptSchedules.LogOnInfo = myTableLogonInfos 'the crystal report viewer Dim myParamField1 As New CrystalDecisions.Web.Parameter Dim myParamField2 As New CrystalDecisions.Web.Parameter Dim myParams As New CrystalDecisions.Web.ParameterCollection myParamField1.DefaultValue = "1" myParamField1.Name = "strCompanyName" myParamField2.DefaultValue = "015210" myParamField2.Name = "strEmployee" myParams.Add(myParamField1) myParams.Add(myParamField2) I tried for the longest time using crystaldecisions.shared.parameterfield(s) and similar, but it wasnt working. Figured I'd give the .web.parameter thing a shot. However, I couldnt find any logonInfo classes objects under .web. What to do Oh, by the way, my error is always either "Could not log on, etc." or "Invalid parameter values", depending on what I fool with. I'm using 2.0
Input string was not in a correct format.   (232 Views)
I have a datatable that I'm using as a shopping cart. I need to be able to remove rows from this datatable. I have an aspx page that displays the datatables contents and I have a button which I want the user to be able to click to remove that particular record. The button's CommandParameter is set to one of the other column's databound field. When the remove button is clicked I get the following error: "Input string was not in a correct format." My method is as follows:protected void Button1_Click(object sender, EventArgs e) { int index = int.Parse(e.ToString()); DataTable tempTable = new DataTable(); tempTable = (DataTable)Session["Cart"]; tempTable.Rows[index].Delete(); Session["Cart"] = tempTable;
Selecting Value from Dynamic DropDownList   (186 Views)
Hi i have a FormView control with a DropDownList in like so:And in the Page_Load event handler i have the following:Dim lstCategoryID As DropDownList = CType(FormView1.FindControl("lstCategoryID"), DropDownList)lstCategoryID.DataSource = Utilities.GetCategoriesList(_sectionID, 0, "")lstCategoryID.DataBind()Which populates the DropDownList fine but i need to select the appropriate value based on the CategoryID for the item i am editing.I tried putting SelectedValue='' on the dropdownlist but it returned the following error."'lstCategoryID' has a SelectedValue which is invalid because it does not exist in the list of items"The trouble is the value for CategoryID is the item i am editing is in the DropDownList. I have had no problem in the past when the DropDownList was statically populated. Therefore i think the problem might be that i am binding the data in the code behind file but i don't know how to solve it.Appreciate your help.
Best Practice for DetailsView   (258 Views)
Using .NET 2.0 and VS2005 I'm creating a new website and I'm trying to utilise the new controls and features were possible.At the moment I'm making a simple update / add record form and initially tried creating the textboxes and using a ObjectDataSource Control set to a TableAdapter to add the fields. This worked but I can't for the life of me work out how to read a record from the ObjectDataSource and populate the textboxes ready for an edit to occur. I'd still be interested in hearing how to do thisAnyway, so I decided to try the detailsview control. At first I couldn't work out how to validate it and add multiline textboxes, but some time playing with templates has got most of that ironed out. However I'm trying to work out the best practice for updating some default fields in the table that the user should not see in the details view. I have a field for modified date to enable basic auditing of the updates and want to update it with the current date and time when the user clicks the update command in the detailsview. How can I do this / what method is best advice greatly appreciated.Cheers, Steve G (MCP)
Error: Redirect URI cannot contain newline characters.   (402 Views)
I'm trying to redirect to a new page but I'm getting the error I mentioned above. I'm passing strings in my redirect. It seems the problem is when there is an \n - sign in the error message or stacktrace. From research in the web I saw that a fix is:1)Create a new webform: error.aspx2)Use Server.Transfer("error.aspx") 3)In the error.aspx page access the error as Server.GetLastError()This last step is what I did not understand. In error.aspx inside of Page_Load I added "Server.GetLastError()".I run the code and I do not get an error anymore but I just get a blank page. nothing gets re-directed. Any suggestion
Spawning seperate thread after http request   (351 Views)
I want to setup a mailing program which allows the user to enter an email message on a aspx page and click submit to their membership list. However when we test it the process has not completed when the http request times out. Is there a way to spawn a seperate thread that continues to run and allows the http response to the requestI am looping through the email list and calling SmtpMail.Send for each individual email address at an interval of 10 seconds. (Some ISP's in my area will consider it spam if they come faster than that from the same host.The process obviously does not complete before the request times out
Null Vales to Stored Proc From SQL datasource...   (198 Views)
Using VS 2005 and SQL Server.I Set up an SQL datasource that connects to a stored procedure with 2 date parameters. The default value for each parameter is set to NULL in the stored procedure.Basically, if a start and end date is sent -- they are used in the "where clause". If not -- then there are no date restrictions applied.In setting up the datasource in .Net, I associated each parameter with a text box control on the web page. of this is being done at design time.When associating the parameters to the controls, I want don't want to pass any value for the parameters when the text boxes are blank.When I run the page and execute the datasource with blank text boxes, it seems to send blank values for the parameters. However, I would like to either send NULL as the value or nothing at all.Can I set it up to a)Not send date parameters when the text boxes are blank or b) send NULL as the values when the text boxes are blankAlso, is there a date validation control available that can be used with a text bo
TemplateField helper function passes variable name not value   (252 Views)
I have the field user_is_active in a table - 1 = active, 0 = inactive.I have a GridView set up and I want it to display text "active/inactive" instead of 1/0. Easy rightIt seems to be passing the variable name "user_is_active" instead of the value 1 or 0 so all records are showing "inactive" in the status column.------------------------------------my Template field: ---my C# Codebehindprotected string GetStatus(string program_status) { if (program_status == "1") { return "active"; } else { return "inactive"; } }------------------------------------I know it's passing the variable name since I put:return program_status + "inactive"; for the if/else and got "user_is_activeinactive" in the status column. I tried variations of "Container.DataItem" which I saw in so many examples but got errors.Can anyone see what I'm doing wrong here
Reporting Service output   (129 Views)
I have an asp.net page which uses a SQL Server 2000 reporting service in the code behind (c#) to generate reports based on the parameters set within the page.The code below shows how the report is output to the screen.The variable result holds the output of the reporting service.CODEResponse.ClearContent();//Response.ContentType = "application/pdf";//Response.ContentType = "application/vnd.ms-excel";Response.ContentType = this.OutputFormat.SelectedValue;Response.BinaryWrite(result);Response.Flush();Response.Close();On some machines this will embed the report within the current page and on other machines it will open either adobe or excel and display the result in a new window.Is there a way of forcing the machine, through the code, to display the report in the way that I want it I.e. so that its always in a new adobe/excel window or always embeddedAlso, is there a manual way of setting how the report is output (ie embedded or in own window) through adobe/IE/excel
how to use style tags inside a label?   (206 Views)
Im using a label to display articles posted by users on my site.if the user enters word im wanting it to convert the text around the strong tags to bold text.but i cant seem to find a way to do it.is there anyway to do this any help would be appreciate
Datagrid: Multiple Rows Per Dataset Row   (509 Views)
If a row of data in a dataset has a lot of columns the row displaying thedata in a datagrid will run way off the screen. What I'd like to do isdisplay a row of data over two datagrid rows so the user doesn't have toscroll horizontally. Essentially, I want to wrap a datagrid row (not text inindividual columns) with as much control as possible. For example, 10 columns on the first row and then 3 columns on the second row for the same physical record in the dataset.Is this possible Or is a datalist the only straightforward way to do thi
General ideas to allow user modify data in a repeater control   (181 Views)
I have a repeater control that renders a grid of data about offers (products to sell on my website). The fields of that grid are: Offer date, Title, Reference, State and Visits. This grid of data appears in the user private menu, and consists in all its published offers. With this grid, the user can control these offers seeing its date, state of the offer (active, eliminated, not available or modified), and the number of visits for each published offer. Now I want the user can modify the sate of each offer when necessary, and I don t know which ASP.NET technique to use so that is fast, easy and has good appearance for the user. The grid example:Date Title Reference State Visits2/12 Furniture at good price F-52-B Active 1421/12 Science book (nature) SB-256 Not Available 530Any ideas (general and/or specific)Thank you,Cesar
Dynamic (nested) datagrid event handling   (254 Views)
I've got a datagrid in my aspx page as follows:CODEWhen the button is clicked I dynamically build another datagrid and add it to a column of the first datagrid. The code for the dynamic datagrid is:CODEif ( ((LinkButton)e.CommandSource).CommandName == "getRaces" ) { //If the ItemType is Item or AlternatingItem, //Create a new DataGrid object named OrdersDataGrid DataGrid dgRaces = new DataGrid(); #region format the datagrid dgRaces.Width = Unit.Percentage(90); dgRaces.CssClass = "dg2"; dgRaces.ShowHeader = false; dgRaces.AutoGenerateColumns = false; dgRaces.ItemCommand +=new DataGridCommandEventHandler(dgRaces_ItemCommand); dgRaces.EnableViewState = true; #endregion BoundColumn bc = new BoundColumn(); //Race Title ButtonColumn btc = new ButtonColumn(); btc.HeaderText = "Race Title"; btc.DataTextField = "raceTitle"; btc.CommandName = "getHorses"; btc.ItemStyle.Wrap = false; dgRaces.Columns.Add(btc); //Bind the DataGrid. string mtgId = e.Item.Cells[0].Text; dgRaces.DataSource = GetRaceData(mtgId); dgRaces.DataBind(); //Add the dg to the original dg. e.Item.Cells[2].Controls.Add(dgRaces);}It gets added fine. I now want to be able to click on any row of this second datagrid and deal with the onClick event but I can't see how. Currently when I click on the row the second datagrid is lost Can anyone help me out here In case it is needed my page_load event looks like this:CODEprivate void Page_Load(object sender, System.EventArgs e){ if (!IsPostBack) { // Put user code to initialize the page here dg.DataSource = GetMeetingData(); dg.DataBind(); }} i love chocolate
Howto refresh datagrid after update database   (237 Views)
how can i refresh datagrid after updating database.First of all i'll describe my problem.I have a webform with a datagrid and a save button. The datagrid consist of row of fields: ID, Name Price, Price is a editable textbox. User can edit as many of the price Textbox as needed, click save button to update all changes back to the database, and the grid will be rebind. The problem is that after rebind , I get thegrid with 6 field as ID,Name, Price, ID,Name ,Price.Do i miss something here or how can i clear the content of the Grid before rebindAny help would be much appreciated. ( please refer to my code below
How to write a software support agreement   (237 Views)
Not a programming question, but i did originally post in "The corporate Water Cooler" forum section my original post wasQuote:I am a new delevoper in the lease my very first real world project is an ecommerce store for this tourist atraction company. I am leaving them and going off to school again, I was(currently am) the sole inhouse developer. When i was hired it was on a temp bases but became full time, i never signed anything there was no contract nothing.Now that i am leaving they seem to realize if the store crashes they are in trouble. So "ethichly" the right thing to do is to give them support to fix the site or what have you.Sense i will be off to school i don't want them bothering me for every little thing, its database driven and very dynamic in there interaction with the site is minimal and far from pain saking.How do i go about writing an agreement are there sites to help with this Any guidlines or things to considerI'm basically thinking a high hourly fee for any recodeing i have to do, new feature fall under new development and would be under a new contract.not responisble for hardware failure, lost of data, user neglagance things like that.I would basically like an agreement that is a deterant to contact me if you will, can't say i like the company and i don't want them to constantly be bothering me when i'm in school. The only thing i should be responisble for is updating the code if needed or rebuilding or what not if the software crashes or has a bug. Not updating the content or new features.In the original thread thread654-1069192It was agreed that I am not obligated to do this but would be a new buisness adventure so liability has to now be take to effect. Any advice on this
windows XP   (268 Views)
forgive me for being dim. I have XP SP2 and have installed VS.NET, .NET framework 1.1 and ASP.NET framework 1.1 and FP extensions 2002, but can't get my machine to run aspx files that are being served out be the webserver on the PC when I browse to them with IE6. Instead it asks if I want to open or save them (and open goes to Visual Studio .NET).Presumably I have missed a step somewhere that maps in IIS 5.1 the ASPX extension to the appropriate program on the PC Please point me in the right direction or to the appropriate docs
ListBox Javascript   (176 Views)
Does anyone have Javascript for limiting the number of selected items (lets say to 5) in a multi-select ListBox using ASP.NET
Infragistics control javascript client side   (609 Views)
I am using third party controls in my asp.net page. They are infragistics controls and i need to validate the choosen date on a webdatechooser on client side and dont know how to get the chosen date ont eh clietn side without postback.any suggestiosn
Lost SQLDataAdapter on page design   (625 Views)
Hi ALL,For some reason, I've lost my SQLDataAdapter, SQLConnection, and Dataset icons that appear at the bottom of the design page. Of course, I need these to make property changes. Anyway, I closed VS and reopened it, but it didn't make any difference. The version I am using is: Microsoft Visual Basic .NET 69461-270-0000007-18910Has anyone seen this before Any thoughts, ideasTIA, Randy
DataSet Null in DropDown Binding   (232 Views)
This is probably a straight forward problem but I can't seem to figure out what is causing the dataset to be NULL -- I am trying to bind a dropdownlist using simple binding:''The entire test page, which calls for the table records and to fill a DataSet, results in the following error:Exception Details: System.ArgumentNullException: Value can not be null. Parameter name: dataSetSource Error: Line 26: cnnWk.Open() Line 27: daType = New OleDbDataAdapter("SELECT Zip, ZipCty FROM tblZipCodes", cnnWk)Line 28: daType.Fill(dsType)Line 29: cnnwk.Close()Line 30: dvType = dsType.Tables(0).DefaultViewThe code, in it's entirety is as follows:CODE Dim daType As OleDbDataAdapterDim dsType As System.Data.DataSetDim dvType As System.Data.DataView Sub Page_Load(sender As Object, e As EventArgs) GetZip()End SubSub GetZip()'open database...Dim cnnWk As OleDbConnection = New OleDbConnection( _ "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=" & Server.MapPath("fpdb\WkshpReg.mdb;")) cnnWk.Open() daType = New OleDbDataAdapter("SELECT Zip, ZipCty FROM tblZipCodes", cnnWk)daType.Fill(dsType) cnnwk.Close()dvType = dsType.Tables(0).DefaultViewEnd Sub TestAny ideas what may cause this I believe the declarations and Imports are fine, and the the table name & field names are also Ok.
Bind data in a repeater to an editable textbox   (148 Views)
Here's my repeater:CODE I'm getting an error with the textbox, saying:"System.Web.HttpException: 'TextBox' cannot have children of type 'DataBoundLiteralControl'."I'd like to pull the data from the table and display it in the textbox, allowing the user to update it. The data is multiple rows returned.
Formatting Unbound Datagrid Columns   (251 Views)
HiCan anyone tell me if I can do centering on a datagrid column when the datagrid does not use bound column
How can I extract information from an image header?   (226 Views)
I am trying to get information from an image that contains a header with parsable fields. Does anybody know how I can extract information from the header of an image I have never done this before, but know it can be done
displaying tree structure   (284 Views)
how do i create & render a tree structure of categories in asp.net using vbi want to render the following on a web page...Animal->Dog ->Cat ->meow ->HorseTree -> Pine -> Redwood -> Some other tree ->Big ->not too bigi am hoping there is some kind of data structure that already does this. src code or links to is appreciated.
FSO and write to files   (193 Views)
Hi togetherI use the code below to write datas to 2 Files (.htaccess and .htpasswd (which wil be used by IISPassword to protect Folders)------------------------------------------------------------