Page encoding is set to GB18030 and it displays perfectly. However, when I retrieve inputted text from HttpContext.Current.Request.Form that's been entered with double-byte characters, the retrieved string contains unreadable characters. Single-byte characters are fine, obviously.
I've tried the following to no avail:
byte[] valueBytes = Encoding.UTF8.GetBytes(HttpContext.Current.Request.Form["fullName"]);
string value = Encoding.UTF8.GetString(valueBytes);
I don't see this problem with other double-byte languages like Japanese or Korean. How can I successfully retrieve double-byte characters from a page that's GB18030 encoded?
when I am searching for Title , my search is working properly for English Titles,But it is not working for the remaining languages like chinese,Tamil etc...,
for this I did following Configurations in .aspx page and web.config side.
I have a database that stores Chinese characters. This works fine. The code for this system is written in vbscript ASP. Here is a sample [URL]
I also access this database via ASP.NET but the characters do not come out in Chinese.
See here [URL]
Why does ASP work and ASP.NET not work?
The code to access the Chinese in ASP.NET is similar to:
query = "select * from myTable ....";
SqlDataAdapter da = new SqlDataAdapter(query, Yart.SQLServerConnections.SqlConnection); DataSet ds = new DataSet(); da.Fill(ds, "paragraphs"); Response.Write((string)ds.Tables["paragraphs"].Rows[0]["chinese"]);
I am thinking it might be my cast to a string that is destroying the encoding perhaps?
I spent a couple days to try to find the solutions online. I am developing a web site which needs to display some Chinese characters. In the MasterPage, I put
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> in the <Head>.
In the MasterPage there are are navigation menus which are Chinese character. I have a web page Default.aspx which uses the MasterPage. In Default.aspx I have some <asp:Label>s which are Chinese characters. On the local computer, I can see all of the Chinese characters. But the problem is: after I ftp all of the files to my web server (DiscountAsp.Net), I only can see the Chinese characters in the MasterPage, I can not see the Chinese characters which belongs to the Default.aspx. Instead of Chinese characters, it displayed weird letters.
I have a form that a user fills out and can input html or other text into a textarea. I have the validaterequest attribute set to false on the page. However, when I submit the form with any html characters it bombs saying that it detected the potentially dangerous request field and to make validaterequest=false. I've already done this so I'm not sure why it's not working. I've done this many times before and never had this problem. Anyone run into this before and if so, is there a fix? I don't want to update my web.config and apply it site wide.
I have 2 table in database 1-State 2-City and bind DropDownList 1-ddlstate 2-ddlCity from these table and when I select item from ddlsate , according to my selected item from ddlState , ddlcity's Item change I used OnSelectedIndexChanged for ddlstate
problem is: I enter some data in tables with persian Alphabet now when I select some Item from ddlstate that contain these alphabet in persian "ی ،پ،... " it didn't show any Item in ddlcity but when I select item that didn't contain above alphabet it show item in ddlcity correctly why this happen?
So I am wondering why it can't read my app.config. I would think that ConfigurationManager would be able to read keys form the Web project's web.config AND my [projectName].config (app.config) file that is in my referenced project as well?
On page load I am populating my own list object, storing in session & it is getting stored, When I am debugging i can see that list object is stored in session, But When I am reading that session variable in next page, it's throwing error like
The type 'Dispensary.ResourceScheduling.Views.SchedulingPopup' exists in both 'WebApplication.dll' and 'App_Web_6bndsqgu.dll'
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. make sure the user has a local user profile on the computer. The connection will be closed.
After I formated my system, When I run my website on local IIS databases, aspnetdb.mdf don't seem to work. But works fine on local Cassini (VS).
But this problem is only with one of my new website , rest everything work fine.
Does it have anything to do with SQL Managment Studio? I din't take any backup of master database and all.
I'm in the middle of moving a web application from IIS6 to IIS7. I've enabled "Windows Authentication" and added <deny users="?" /> to the authorization section of my web.config file. When the app was running on IIS6 my users where able to access the web app without logging in because their windows login was automatically recognized. This does not seem to be the case in II7. I can not get a value for "Current.User.Identity.Name" in my ASP.Net code.
i am running with an unfamilier issue with jquery ajax and wcf service . i have created a simple wcf service and trying to show it on a asp.net label... the wcf service just returns a string which has to b shown on a label. the url has been set on jquery ajax url to call the wcf service using rest. but somehow i am not getting the desired thing done . the ajax cannot retrieve the data from the wcf service , here are the code snippets.
The Ajax Portion in default.aspx :
[Code]....
The Service Contract for WCF :
[Code]....
The implemented Method :
[Code]....
and the Web.Config :
[Code]....
can someone figure out here i am going wrong .... that the ajax is unable to retrieve the data from the above wcf Service .. its just a very basic and simple one .. but unable to figure out the Real Prblem.
I had a stored procedure as below. I'm trying to return an integer of differences btw 2 integers. In SQL Server 2008, the stored procedure works just fine, it shows me the value I wanted in @intdiff.
But when I try to retrieve it with my webservice, it only return value 0. My webservice coding as below. Could any1 come accross this before?
I have a form in a page and a panel inside the form.The panel gets loaded with dynamic controls like radio button and text boxes.
User is allowed to choose any radio option and enter any value in the textbox beside it and then goes for submit button to move to next stage.
Problem Descritopn:
I load the controls in the panel based on the index of a combo control on the same form.it is done in selectedIndexChanged - This is working fine.
When i go for the submit button and ask for the textbox control, it says "object reference not set to instance of object", denoting that instance is not available. Moreover the panel control list gets empty automatically.
I need to retirve data from two tables...when i click a value in dropdown list, i need to retrieve values from two tables based on that id( which i have selected in dropdown)..so when i have written query ( "Select assign_issue.issue_assigned_to, assign_issue.created_on,assign_issue.last_Date, issue_register.issue_desc,issue_register.issue_Priority from assign_issue INNER JOIN Issue_register ON assign_Issue.Issue_ID = issue_register.Issue_ID where issue_register = '" + ddlissueid.selecteditem.text + "'")..query is executing ..when it comes to dr = cmd.executereader()..Dr is unable to read..it is showing false when i trace..unable to read into while loop.
i got checkbox in gridview which put inside the itemtemplate. the problem is when i tick on the checkbox, the value for checked property still is a false value. Wat;s wrong?
If GridViewRDR1_Hidden.Rows.Count > 0 Then For Each row As GridViewRow In GridViewRDR1_Hidden.Rows Dim cb As CheckBox = CType(row.FindControl("chkstatus"), CheckBox ) If cb.Checked Then MsgBox("True") End If Next End If
I am trying to update the database with the edited data. However, it did not manage to read the edited data from the textbox. It returned the retrieve data that I have done in the Page_Load instead. Is there any part of the code that I have written wrongly? I did manage not to use <EditItemTemplate> in my past project and manage to update the database with the same logic.
<aspx> <!-- This DataList is created to view Personal Information --> <asp:DataList ID="personal_dl" runat="server"> <ItemTemplate> <table> <tr> <td style="width: 100px; text-align: left;"> <asp:Label ID="first_lbl" runat="server" ForeColor="Black" Font-Size="11px" Text="First:"></asp:Label></td> <td style="width: 350px"> <asp:TextBox ID="first_tb" runat="server" Width="341px" Font-Size="11px" Text='<%# Eval("FIRST") %>'> </asp:TextBox> </td> </tr> <tr> <td style="width: 100px; text-align: left"> <asp:Label ID="name_lbl" runat="server" Font-Size="11px" ForeColor="Black" Text="Name:"></asp:Label> </td> <td style="width: 350px"> <asp:TextBox ID="name_tb" runat="server" Width="341px" Font-Size="11px" Text='<%# Eval("NAME") %>'> </asp:TextBox> </td> </tr> <tr> <td style="width: 100px; text-align: left;"> <asp:Label ID="id_lbl" runat="server" ForeColor="Black" Font-Size="11px" Text="ID:"> </asp:Label> </td> <td style="width: 350px"> <asp:TextBox ID="id_tb" runat="server" Width="341px" Font-Size="11px" Text='<%# Eval("ID") %>'> </asp:TextBox> </td> </tr> <tr> <td style="width: 100px; text-align: left;"> <asp:Label ID="contact_lbl" runat="server" ForeColor="Black" Font-Size="11px" Text="Contact No.:"> </asp:Label> </td> <td style="width: 350px"> <asp:TextBox ID="contact_tb" runat="server" Width="341px" Font-Size="11px" Text='<%# Eval("TELEPHONE_HP") %>'> </asp:TextBox> </td> </tr> <tr> <td style="width: 100px; text-align: left;"> <asp:Label ID="add_lbl" runat="server" ForeColor="Black" Font-Size="11px" Text="Address:"> </asp:Label> </td> <td style="width: 350px"> <asp:TextBox ID="add_tb" runat="server" Width="341px" Font-Size="11px" Text='<%# Eval("ADDRESS") %>'> </asp:TextBox> </td> </tr> </table> </ItemTemplate> </asp:DataList> <br /> <div style="text-align: center; color: Red; width: 460px;"> <asp:Label ID="errorMsg_lbl" runat="server" /> <asp:Button ID="edit_btn" runat="server" Text="Update" /> <asp:Button ID="createBtn" runat="server" Text="Insert" /></div> <aspx.vb> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'display information in datalist Dim login As String = Session("login") Dim id As String = Session("id") bindDataList(personal_dl, getPersonalContent(login, id)) 'display necessary DataList personal_dl.Visible = True 'declare fields Dim i As Integer Dim first_tb, name_tb, id_tb, contact_tb, add_tb As New TextBox For i = 0 To personal_dl.Items.Count - 1 first_tb = personal_dl.Items(i).FindControl("first_tb") name_tb = personal_dl.Items(i).FindControl("name_tb") id_tb = personal_dl.Items(i).FindControl("id_tb") contact_tb = personal_dl.Items(i).FindControl("contact_tb") add_tb = personal_dl.Items(i).FindControl("add_tb") 'set fields as ReadOnly - cannot edit first_tb.ReadOnly = False name_tb.ReadOnly = False id_tb.ReadOnly = False contact_tb.ReadOnly = False add_tb.ReadOnly = False Next End Sub
Protected Sub edit_btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles edit_btn.Click 'declare fields Dim i As Integer Dim first_tb, name_tb, id_tb, contact_tb, add_tb As New TextBox Dim id As String = Session("id") For i = 0 To personal_dl.Items.Count - 1 first_tb = personal_dl.Items(i).FindControl("first_tb") name_tb = personal_dl.Items(i).FindControl("name_tb") id_tb = personal_dl.Items(i).FindControl("id_tb") contact_tb = personal_dl.Items(i).FindControl("contact_tb") add_tb = personal_dl.Items(i).FindControl("add_tb") Next Dim myConnection As OleDbConnection = dbConnection() Dim cmd As New OleDbCommand Dim sqlStatement As String Dim condition As String condition = "UPDATE staff " + _ "SET ((FIRST= @FIRST), (NAME = @NAME), (ID= @ID), (TELEPHONE_NO = @CONTACT_NO), (ADDRESS = @ADDRESS)) " + _ "WHERE (ID= @id)" sqlStatement = condition cmd.CommandText = sqlStatement cmd.CommandType = CommandType.Text cmd.Parameters.AddWithValue("@FIRST", first_tb) cmd.Parameters.AddWithValue("@NAME", name_tb) cmd.Parameters.AddWithValue("@ID", id_tb) cmd.Parameters.AddWithValue("@TELEPHONE_NO", contact_tb) cmd.Parameters.AddWithValue("@ADDRESS", add_tb) cmd.Parameters.AddWithValue("@ID", id) cmd.Connection = myConnection Try myConnection.Open() cmd.ExecuteNonQuery() Catch ex As Exception Finally If myConnection.State = ConnectionState.Open Then myConnection.Close() End If End Try 'display information in datalist Dim login As String = Session("login") bindDataList(personal_dl, getPersonalContent(login, id)) End Sub
I have read in many places that referencing IRequiresSessionState or IReadOnlySessionState will allow me access to the Session scoped variables from within the ProcessRequest method in an ASHX file.
I have implemented these changes, as follows, and I am unable to retrieve this data still, as the server returns a null object reference error:
using System; using System.Web; using System.Web.SessionState;[code]....
The error is most certainly specific to pulling data from the session, yet I am 100% certain that the session contains data in this key.
It shouldnt matter where I am storing the data (cookies, vs db, etc), right?