VS 2010 / Swedish Letters In Web Response Coded Wrong
Mar 28, 2013
I have a vb.net local application that reports to a web server with POST method.
Unfortunately, like it says in the title, the swedish characters (among others I guess) comes back in ASCII (I think).
local app:
Code:
Function doHtmlPost(ByVal url As String) As String
Dim strResult As String = ""
Dim myWriter As StreamWriter
Dim mystring As String
Dim strR As New StreamReader("c: estmytext.txt", Encoding.UTF8)
I have a weird thing happening. I have two identical databases installed on one virtual machine but under two different instances of SQLServer. For some reason, periodically when saving from one it will save to the other instead. Using debug, I have verified that the connection string is correct and when the item saves, it still saves to the wrong database.I use session variable, and am of the belief that it might have something to do with it...and t hat when I go from one to the other it is still getting the connection string form the other for some reason.To make sure that it isn't a problem, I make sure that I completely close out one database before opening the other in a new IE window.I assume that when I completely close out an internet explorer window that it abandons all session states. Is that true?
I've had this problem for a while now, it seems to come and go (sometimes it happens, sometimes it doesn't) and I can't really figure out what's wrong.Basically my aspx code will sometimes format automatically, except not in the way I want it to. I always structure html and xml-like code as such:
This way I can quickly see which tags belong to which, and I think this is the usual way html is formatted, right? Anyway, suppose that I have this code in my aspx code window (don't mind that it's not aspx code, that's not the point), then sometimes VS will automatically format it to this:
Basically it seems to put all closing tags on the last line, leaving me sometimes (with many nested tags) with an extremely long line at the end, making it completely impossible to see the structure of my code. Here is an actual example. This is how I wrote my code:
I am doing Automated coded ui testing in asp.net 2010 for web application. I am testing site and i need to know how can i create the test which will work with all browsers. Right now i created test in IE 8 but its not working in Firefox. So is there any way i can create one test and will work in all browser.
I'm getting my text from a textbox from code-behind using control.Text() but I'm not getting the proper characters, I want "ÅÄÖ". Must be some problem with the text encoding but I've already checked my encoding settings in VS. Someone??
For my login page, I use the built in stuff in vwd. However I am trying to change the background color of the login fieldset. Simple, right?
Well IE doesn't work, no surprise, filling the whole box with the color and then drawing the top border a bit down. I solved this by positioning the legend absolute at -.8em. So far so good. It works with IE.
In stead, FF is bungling. Now the border is visible in the legend, although not on top of the text. Still, it almost looks as a strikethrough font.
I just want a fieldset with a legend and a background color that stays within the border. And that works with all browsers.
I have a very weird thing happening. I have two databases that have exactly the same tables but different database names on the same virtual machine, but in different instances of SQL Server. For some reason, when using one of them, it will save to the other. In debug, looking at my connection string..I have verified that it is correct, yet when I allow the save, I look in the table and it isn't there, it is in the other database that is in a table with a completely different name and in a different instance of SQL Server.
I have a download button on my website to download an application of mine. It works fine but I noticed people are clicking it repeatedly. The response time is a little slow after you click the button. Not that bad for me but maybe it's worse for some. In the button click sub I have the code to get the file and bring up the download window and I also have code to increment a table for download count and get the IP address of the person who clicked the button. If I just have the code necessary to do the download the download window comes up a little bit quicker. Here's my button click sub :
Code: Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click ' Dim FilePath As String = Server.MapPath("~/FolderForDownload/MyApplication.exe") Dim myfile As New System.IO.FileInfo(FilePath) If myfile.Exists Then Response.AddHeader("Content-Disposition", "attachment; filename=" + myfile.Name)
[Code] ...
What I've noticed is that when I had Responcse.End() before my code to get the IP address and increment my table and save the IP Address it would skip performing that code so I moved it below the code. It performs the code but I noticed that after you click the button it takes longer before you see the window pop up that asks if you want to Run or Save.
I tried putting the code to get the IP address and increment my table in a separate sub and then call the sub after Response.End() but it still doesn't perform that code unless I call that sub before Response.End().
I'd like to do everything I'm now doing but get the Do you want to Run or Save window to open sooner. I'm getting a number of people downloading my application from overseas and perhaps when it runs the code to identify the IP address it takes longer. I'm not sure but I see people clicking the download button repeatedly. My table records the exact time to the second when they clicked the download button and to take an example, there are 4 consecutive entries with the same IP address and the times are 3:28 PM for all 4 with the seconds being, 13, 15, 16, and 17.
I put a test download page on my website. When I was running in Visual Studio and using a localhost address I was seeing a big difference in how quickly the window opens after you click the download button if there's download code only versus download code with the other code. When I copied the page to my website and accessed the webpage on the internet there didn't seem to be hardly any difference.
Here's a link to the test page on my website if you want to try it out. You don't have to download anything but you can see how quickly the window opens asking if you want to run or save. There are 2 buttons on the page. One says Download Code Only and the other Download Code and Other Code.
[URL] ....
I just tried it out and I saw a big difference in time between the two but earlier I didn't. Sometimes I think the added code runs faster and other times slower.
As I have migrated Web Application from 3.5 (VS 2008 ) to 4.0 Vs (2010)
Now i am having problem with Response.Redirect
As I in .aspx pages i have found the following solution and it is working fine.
old Code with is not Working in Vs2010
[code]....
But now I need to Redirect from the class librarySo can any one guide me on the same.. i can i redirect .. AS I have try with HttpContext.Current.Response.Redirect(strURL); but it is not working.
The simple website I am trying to build is a list of banks with their corresponding website. I also wanted the ability to add banks/website with the use of some text boxes and a button click event. I've got this fully working until I publish it. When I try to run it on the webserver it say it can not find the specified file c:windowssystem32inetservURLs.xml Now I understand the problem I just can not seem to fix it with out hard coding the path of the file into code.
Partial Class _Default Inherits System.Web.UI.Page Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click ' Load the Document Dim Doc As New XmlDocument Doc.Load("URLs.xml") 'Create a New Element Dim bankNode As XmlNode bankNode = Doc.CreateElement("bank") 'create and add sub elements for this node Dim nameNode, addressNode, dateNode As XmlNode ' nameNode = Doc.CreateElement("name") addressNode = Doc.CreateElement("address") dateNode = Doc.CreateElement("date") bankNode.AppendChild(nameNode) bankNode.AppendChild(addressNode) bankNode.AppendChild(dateNode) 'add the text data nameNode.AppendChild(Doc.CreateTextNode(tbWebsite.Text)) addressNode.AppendChild(Doc.CreateTextNode(tbAddress.Text)) dateNode.AppendChild(Doc.CreateTextNode(DateTime.Today)) 'add the new element to the end of the list Doc.DocumentElement.AppendChild(bankNode) 'save it Doc.Save("URLS.xml") End Sub End Class
I built a crystal report using crystal report 2008, and have it working fine aganist my test db. in my c# code that loads the report I put this in:
[Code]....
but problem is when i pushed this change to production, the report was stilling pulling test data, even though the web.config entry (LocalSqlServer) was updated in production to use production db. Could I have setup the crystal file incorrectly? When I'm creating the crystal file and connecting it to the db, is there something that I need to check or uncheck to tell it I'm going to dynamically supply the db connection rather than having it use the one I used to setup the report?
I am working on a ASP.NET MVC 2.0 Multi-Presentation web application which would use a common codebase to support different websites. These websites would differ in following aspects:
Each website will have their own headers, footers, images, CSS etc (I guess website specific Master Pages) Some of the UI elements could be different based on soft-coded settings at website level
What is the best approach to handle these requirements? Should I be storing these website level soft-coded settings in Database or multiple config files? I might have to provide a admin UI to manage these soft-coded settings. How do I access these settings in different layers (MVC, Services, Repositories etc) of my application?
I am running a LINQ query which populates a list used by a DropDownList, I need to insert an "Unassigned" value to the list. The function below queries the values correctly from the db but does not insert the "Unaasinged" value to the list.
As the title says then the question is relative simple however I cant decide whether a resource file with strings in is better than hard-coded strings...
I want to use this to insert and edit values from a db. For example when adding a record the user selects 'One Day Shoots' and 1 gets inserted into the database. Then if the user goes to edit the page since the value in the db is 1 then the 'One Day Shoots' is selected.
One way I considered accomplishing this was by using a hidden feild - when the user selects something in the dropdown list the field is updated with the value, then when the user actually adds the record the value in the feild is submitted. I'm pretty sure this would work but is there a better way?
I'm relativley new to ASP and am using VB for the coding. I have a page that has a few fields on it, one being a drop down list that get's populated from a SQL Server.
I used the GUI to generate this form (see below), the connectionstring:Prod1ConnectionString that is stored in the web config file is hard coded. I want to change that I use the connection string that is passed as a Session parameter. I've been looking for hours for an example of how to remove the connectionstring from the web code and place the proper code in code behind script on the load_page event.
I have a little doubt about creating a login control in the master page within a contentplaceholder.
What i want is to create my own login control in the masterpage, using a loginview inside a contentplaceholder. The code is the following:
[Code]....
So far so good, but now i want to create the logic to do the actual login. In a regular aspx page i'll do it in the cmdlogin click event, but as i'm in the masterpage, i'm not sure if i can do that. I actually tried to do it in the code behind of the masterpage, but it didn't work. What can do?? do i ahve to use the asp.net login control?
I need to generate a GridView and inside of one of the cells insert a DropDownList.
The GridView is a list of the users of the web application.The DropDownList is a list of roles of the web aplication.
The GridView is to be a table with the diferent users, diferent columns with various information, the last cell should have a DropDownList with the roles, the role which the user of the line belongs to, should be visible!
I have a asp.net page with .net controls. For a long time, many years, pages was run correctly. But lately some signs were change from their normal display mode to squares. Looks like some encoding issue, but changing it, dosen't .How can I resolve this issue? Why do I see square boxes instead of some signs?
I would like to know what the expression for "letters only" is for my asp.net web application. I tried ^[A-Za-z] but it does not work I would also like a regular expression for "numbers only except "-"
I receive lists from a web service and then I convert the lists to datatable and then I add the datatables to a dataset and from there I get the xml from the dataset where I can save it into a sql database. But the problem is that the xml has /r/n between all attributes and elements. I dont know how to get this out of the xml. Can this be because of my converter. If so can anyone give me a better way to get multiple lists into a dataset.