if i click submit.. a file is then created in xml format but if i enter new data it will overwrite the same file how do i stop this..
this is the code i am using
Protected Sub btnWriteXML_onClick(ByVal sender As Object, ByVal e As System.EventArgs)
Try
Dim enc As Encoding
Dim objXMLTW As New XmlTextWriter(Server.MapPath("contact.xml"), enc)
objXMLTW.WriteStartDocument()
objXMLTW.WriteStartElement("Feedback Form")
As you can see there is a ControlParameter bound to a TextBox on the aspx page. So the content of this TextBox is a parameter for my SelectMethod. But there is a special button on the page: When this button is clicked and a postback occurs I don't want that the DataSource extracts the content of the TextBox to control the selection, instead I want to set a specific hard value "x" as the selection parameter.
How can I do that? Can I "disable" in some way the ControlParameter when this specific button is clicked and set my special value instead? Or is there any other way?
When I publish my Asp.Net MVC website to the production server (via VS2008), the web.config & castle.xml files are overwritten. The content of these files is obviously different between my local dev environment and the production server.How do I prevent these files from being published?
whenever we work with linkbutton then we always found linkbutton href="__dopostback(...)" but i want to overwrite this when i add linkbutton.attribute.add("href","myfunction") then i saw two href is there in source code. so i want to stop this. i want only my function will be there when i will write the code like linkbutton.attribute.add("href","myfunction").
I am attempting to set the content-type of an asp.net .ashx file to text/plain.
When I run this through the ASP.NET Development Server, the content-type is properly set. When I serve it through IIS7, however, the content-type (and any other header values I set) don't come through (it came through as text/html).
The only value set in the HTTP Response Headers section of IIS Manager is the X-Powered-By attribute. I tried setting the content-type here, but that didn't work. But if I removed the X-Powered-By attribute, it was removed from the header.
I'm developing a httpHandler, in my source code if some conditions aren't met i would like to stop uploading file to the server ( for example file extension is not allowed)
When I try to quit ProcessRequest function with return null;, asp.net tries and uploads the file automatically before I quit the httpHandler...
How can I stop asp.net to automatically upload posted files?
Here is the list of thing I've tested so far and no luck:
public void ProcessRequest(HttpContext context) { var worker = (HttpWorkerRequest)provider.GetService(typeof(HttpWorkerRequest)); .......... worker.CloseConnection(); context.Response.End(); Environment.Exit(0); return null; }
I get the following error when overwriting my asp.net .dll sometimes on my web server. The server is running Windows 2008 and IIS7. The only way I can seem to resolve the issue is to restart IIS7 completely.
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. review the following specific error details and modify your source code appropriately.
Compiler Error Message: The compiler failed with error code -1073741502.
Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016
I have an AJAX-heavy ASP.NET web application developed using .NET 4.0, using TFS as our source control. We recently upgraded our dev tools to use VS2010 and TFS 2010 exclusively, but now every time a file is checked out, we see visual studio reloading all the symbols, and all the sessions being dropped.
After putting some error logging code, we discovered the reason for the recycle is it reckons App_offline.htm is changing whenever we check out. This doesn't exist anywhere in the project, and my SO-fu has found some information about SQL Express making this file get created and deleted, so it's possible that's what's happening here.
It looks like I do have SQL-Express installed, but even disabling the services that are running, the problem persists.
Is there any way to stop a check out from adding/removing this file, if this is indeed what is happening? It's beyond frustrating to have the app recycle whenever I simply check out a file...
My testers have discovered that if you type free text into a file upload input then none of the buttons on the page work until that text is removed (so the page cannot be submitted).
I am able to replicate this with the following ASPX code (with no code behind):
(Note that I haven't bound any handlers to the page; despite this, the page is submitted when the submit button is clicked only if no text is entered into the upload text box)
Is there any way to prevent users from typing free text into a file upload control? It seems that this is only possible in IE - Firefox and Chrome natively prevent text from being entered into upload input fields.
I've seen solutions elsewhere which suggest hiding input and replacing it with a label / button combo, but this seems like it might cause more problems and work inconsistently across browsers.
But some times the file that is read, reports that there is more rows than there actually are. i.e. I only have 300 lines of data but the read reads in 500. My question is, and I am sure I have seen this somewhere but I cannot find it now, is how do I get the reader to stop reading at the first blank line?
I am building a web application. Here's what I do.
Set the solution Configuration Manager to Release. Thus all projects are building the Release version. Then I clean the solution and build all. Then I "Build Deployment Package".
When running the installed code from the deployment package I notice when there is a bug in the compiled source the source file appears! How is this possible, I am building the Release configuration. The source code is definitely not in the release so it must be in the dlls.
I have a validation method which passes the control of a failed validation ( IE TextBox in the Gridview row ) to a method which adds a validationError style.This all worked fine until I decided to use declarative css styling on the properties of the columns in the page IE Control-CssClass="someClass".
WHen I click the update and do find an error, I pass the control to have the validationError class appended. but it appears the declarative setting overrides this when it gets rendered.
I'm currently editing some html/css within a aspx file inside of Visual Studio 2010. I'm using Chrome as my browser. When I make changes inside of Visual Studio and save/ctrl + F5 to run it frequently fails to load the new updated .css file due to pulling old cached versions of the CSS.
I've used visual studio as my primary HTML editor before but when I work with pure html/css files I just save and refresh the file in chrome and it will refresh the updated css 100% of the time. I've only started to experience this problem when working with aspx files and running things via ctrl + f5. Anyone have any ideas of how I can fix this?
to set a new sessionId on sign out, but when the session expires, the sessionId is reused if the browser instance is not closed. In my web.config I have used
but still get sessions reused. I can't kill the cookie in Session_end() because I don't have access because there is no HttpContext or request, so I can't reset it that way. how I can force a new sessionId from the Global.asax.cs file?
I have a file upload area and would like to stop the pop-up box area from closing when the user has uploaded their file. Anyone know how I can do this ? this is the code:
then what happens when the first user controls load then test.js will download in client and when second user control loads then test.js file will download again.
How do I check to see if the JavaScript file is already downloaded so it doesn't have to be downloaded again?
If I include the JavaScript file from the server side:
I am not too clear about the IIS lifecycle, but my general understanding is:
Every couple of hours IIS resets itself. This is apparently done so as to fix up any memory leaks, resource deadlocks etc. etc. ie. It seems to be a cleanup operation.
Every couple more hours (I think I read 23 hours) the server just stops listening to inbound requests and runs Application_End. An external page request will restart the app.
Can I get a bit more reasoning to why these behaviors occur? Especially with regards to item #2... My server runs internal scheduling behaviors which completely died last night. The reason was that Application_End occurs and no customer requests were happening to start the IIS server again. This seems weird. Why not just clean up memory leaks etc. and then keep IIS running exactly as it was?
I have 2 pages..In Both the pages i have one button.If i click Btn in Page one it should transfer the control to Page2 .But if i Click button in Page 2 it should not reload the Page1.It should just display the data in page1 without reloading.
I have a grid at the bottom of my website. There is an image button that addas a new row to the grid but as i click the image button the scrolling moves to the top disturbing the focus of the page. How can i stop the scrolling at one position only.
I'm seeing an issue of some static pages that are using the browser cache, which is not desired. To prevent caching, I'm setting
<clientCache cacheControlMode="DisableCache" />
in the relevant <location> tag in web.config
If I open the page in Firebug (in the Net tab), I see that the Response headers have Cache-Control: no-cache which is correct, but the status of the Response is 304 Not Modified! Isn't that a contradiction? How can I get it to stop caching (i.e. always send a 200 with content)?
I am creating online application in asp.net, there are some dropdownlist on a page, when i select some item from the dropdown list page load is calling again, how can i stop this?
I have two custom ActionFilters on an action. In first of the actionfilters, I have an redirect performed if a condition is not met (classic authorization). And in another I have an redirect performed if another condition is not met (say role checking). But I do not want to continue to the second actionFilter if the first one is not met. How to do this?
This has been covered a couple of times, without a suitable answer:[URL]
I have created a custom paging data class that is used with an ObjectDataSource. In intial tests, I found it was performing worse than my old SqlDataSource code. Whilst investigating, I found that for every page load, the ObjectDataSource is being created and binding twice.
Investigating the links above led me to believe this could be a bug (or unexplained behavior) in regards to changing my GridView's column visibility in the OnDataBound event like so:
I use this event to customize the display of certain fields, as well as hide columns that are not pplicable during some search types. When I disable the event, the ODS stops binding twice. I can't really think of a way to get around this behavior. Has anyone else see this issue or developed a work around?