-1

hi when i try to post this textbox text , i got this error.

"Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500"

my page:

<%@ Page Title="" Language="C#" MasterPageFile="~/Yonetim/Yonetim.Master" AutoEventWireup="true"
CodeBehind="ImzaDetay.aspx.cs" Inherits="Yonetim.Detay" ValidateRequest="false" EnableEventValidation="false"%>

my textbox:

<asp:TextBox ID="txt_SQL_STR" TextMode="MultiLine" runat="server" Width="100%"
                                                        Height="1000px" />

i try this :

<%@ Page ValidateRequest="false" %>

but i got same error.

It works for me :

CREATE TABLE EMPLOYEE3 AS
   (SELECT PROJNO, PROJNAME, DEPTNO
    FROM EMPLOYEE
    WHERE DEPTNO = 'D11') WITH NO DATA

It makes me crazy !! :

SELECT 
       DATED,
       decode(dated,TRUNC(SYSDATE),'<div style="color: red;">') || to_char(t.dated,'dd.mm.yyyy') || decode(dated,TRUNC(SYSDATE),'</div')   DATED2,
       to_char(t.dated,'dd.mm.yyyy') DATED3,
       WEEK_NO  week_no,
       decode(dated,TRUNC(SYSDATE),'<div style="color: red;">') || WEEK_DAY  || decode(dated,TRUNC(SYSDATE),'</div') week_day  ,
       decode(dated,TRUNC(SYSDATE),'<div style="color: red;">') || CUSTOMER_ID  || decode(dated,TRUNC(SYSDATE),'</div') customer_id  ,
       decode(dated,TRUNC(SYSDATE),'<div style="color: red;">') || c_inf_api.get_name(t.customer_id) || decode(dated,TRUNC(SYSDATE),'</div') customer_name ,
       XXX_TABLE,
       XXX_TABLE,
       XXX_TABLE,
       XXX_TABLE,
       t.YYY_TABLE,
       T.OBJID,
       T.OBJVERSION,
       decode(dated,TRUNC(SYSDATE),'<div style="color: red;">') || T.STATE || decode(dated,TRUNC(SYSDATE),'</div')   state

FROM time_db_qry t,
     p_info p
WHERE p.person_id=t.person_id
AND t.dated BETWEEN trunc(SYSDATE)-4 AND trunc(SYSDATE) + 25
and p.user_id='XXXXX'
ORDER BY dated
Mennan
  • 4,451
  • 13
  • 54
  • 86
  • Can you clarify what you mean by "save a long sql string". Clearly you are using webforms, but can we see some code? – emd Apr 13 '12 at 16:10
  • sorry about my en.When i clicked save button , i post my textbox value to code behind.First sql string that i wrote , there is no problem.But i got problem saving second sql string – Mennan Apr 13 '12 at 16:15
  • I'm not sure why you're inputting an sql string in a text box... or am I misunderstanding? – emd Apr 13 '12 at 16:24
  • I think a better question might be why are you posting SQL code into a ASP.NET text box and sending that back to the server? – Michael Ciba Apr 13 '12 at 16:30

1 Answers1

3

I have seen this before. It looks like you put html markup in your textbox and then posted the form. Asp.Net catches that and throws an error for security reasons. It will make your app slightly less secure, but if you really need to pass that html, this will work:

<system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime requestValidationMode="2.0" />
</system.web>

It appears you can also do it for just one page.

<location path="XX/YY">
    <system.web>
        <httpRuntime requestValidationMode="2.0" />
    </system.web>
</location>

Credit where credit is due

Community
  • 1
  • 1
SouthShoreAK
  • 4,176
  • 2
  • 26
  • 48