.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Get CssClass value using Request.Form

Posted By:      Posted Date: October 10, 2010    Points: 0   Category :ASP.Net

Hi all,

Is it possible to get the CssClass and SkinID via Request.Form? 

I tried below but failed.

Dim i As Integer
        Dim itemName As String
        Dim itemValue As String

        For i = 0 To HttpContext.Current.Request.Form.Count - 1
            itemName = HttpContext.Current.Request.Form.AllKeys(i)
            'itemValue = HttpContext.Current.Request.Form.GetValues(i)(0)
            itemValue = HttpContext.Current.Request.Form.Get("CssClass")


View Complete Post

More Related Resource Links

Difficult in using Request.Form

Hi all,i just try to pass value between pages using Request.Form,Here the scenario,1.First i created a two aspx pages(First.aspx and Second.aspx), First.aspx is a main page and Second.aspx is a popup.2.in the main page i created a button with type submit and text box , and in the button  onclick i call a function in the javascript which open the popup page3.When i try to retrieve the values from the main page in the popup i can't retrieve the valuesHere the codeFirst.aspx=========================================================<script language="javascript"> function fnClear() {window.open("Second.aspx","sendvalue","height=350,width=700,scrollbars=1");                }</Script><form id="mainpage" name="mainpage" method=post runat="server"><input type="text" name="txtStDate" runat="server" tabindex="1"                                                                                                 id="txtStDate" maxlength="

AJAX Form POST Request to a DLL Problem

I am using AJAX javascript for POSTING a complete HTML form to the server which is an external dll on a different server and displaying the response. The server-response is displayed in a "div" . basically i need to show a poll in a .aspx page which is basic a question with 3 options & a button. Now on click of submit button i need to post the data to a dll & show the result from the dll itself. Any idea how to do this? is it possible..any code???

Clearing ValidationSummary when form returns a download request



Here's my setup:

Simple mvc page with a few controls that includes a validation summary area. 

Once the fields are completed there's a download button.

If I enter something invalid, as expected, my controller code updates the UI with the appropriate error.  However, if I then correct the error, and then click the download button a file is downloaded, but the UI never gets updated - presumeably since there's no update on the view.

Any ideas on a way around this - perhaps some javascript code.  Just wondering what's the best practice here?


Leave Request Form


I now have recreated my Leave request form in sharepoint designer and just need a few pointers.

Ill explain what i have first.

I have a document libary call time-off request here users can fill out a word template requesting leave they fill out the following fields.

Employee Name, Start Date: Return Date: Type Of Holiday

Once they have saved this back to the libary the workflow starts it marks the status of the request to open it then copys the item into a new list called Time-Off Request Status and then deletes the item in the Time Off Request List finally it emails the manager of that employee telling them to approve or reject the request in the the Time Off Request status libary.

There is another workflow attached to the Time Off Request status libary where if the manager approves the request it sends an email to that user and updates days remaing in a final list called annual leave remaining.

The problem that i have is any user can go into the Annual Leave remaining list and change the number of days that they have left however i need them to have the contribute permission so the workflow can update the list.

I asked a similar question back when i created this in Sharepoint Services  3.0 and was told something about impersonating work flow steps but i am unsure of how to do this.

Also the workflow does no

wcf 4 rest service accepts xml and json posts but get 400 bad request on form post


Using the rest 4 template.  I have a POST method defined, with an object as a parameter.  REST 4 does a great job of automatically mapping both xml and json posts to the method.  I tested this using an HttpClient test application to build and post xml content and then json content.  All data gets correctly mapped to the corresponding properties in my entity. 

I want to also support a standard form post to the method but am having problems! 

I'd like the same method already accepting and converting both xml and json to also work correctly for a form post.  I figured it would "just work" but no.

I am testing this by creating an HttpUrlEncoded form in the test client, adding form name/value pairs that match what the method is expecting, and trying to post it.

However I get a 400 Bad Request.  Here's some example code that is returning a 400 bad request:

Really straightforward but fails.  Ideas why? 


      var client = new HttpClient();

      HttpUrlEncodedForm form = new HttpUrlEncodedForm();
      form.Add("Id", "99"<

use infopath form for request and appoval



i have created an infopath form. when the user submit this request form to the specific approver a mail will be sent to the specific approver.

now i want that when the approver open this form, the fields that the user had filled must be read only and the approver section must not be read only. the appover must be able to approve the form and submit the same form to the hr.

the approver section has a dataview list where the approver can choose if the request is approved or rejected.

i know i can use a workflow, but if i use a workflow can the workflow send the request to the specific approver of each user?

cause in my form when the user open the form there is a field that is filled with the specific approver of the user. and when the user click on the submit button the form will be send by mail to the specific approver.



A potentially dangerous Request.Form value was detected from the client


I know this has been discussed already but my problem isn't the error itself. My problem is I am including [ValidateInput(false)] above my ActionResult and I still receive this error when I click submit. Is there something somewhere else overriding this command?

Here is what the code looks like.

[Authorize(Roles = "Administrator")]
        public ActionResult Create(FormCollection Form)

[Authorize(Roles = "Administrator")]



Help! Can't find dynamic button's postback in page.request.form??


Okay, I know that dynamic buttons and buttons in general don't use a typical postback and they post through the page.request.form.  Okay, so in visual studio, I was able to determine that page.Request.form and in the all-keys property, i SEE my button there.  It is the last item in all-keys.

When I am clicking this dynamic button which is in an updatepanel, the script below does not detect it as a button, it is still showing it as null:

public static Control GetPostBackControl(Page page)

            Control control = null;
            string ctrlname = page.Request.Params.Get("__EVENTTARGET");
            if (ctrlname != null && ctrlname != string.Empty)
                control = page.FindControl(ctrlname);

A potentially dangerous Request.Form value was detected from the client



i have a form that use can insert some text in textbox

if user insert <..> page return an error like

A potentially dangerous Request.Form value was detected from the client 

the problem is i need to user inter some html code that's because i change the code in web.config file

<pages validateRequest="false"

URGENT!!, A potentially dangerous Request.Form value was detected from the client



I get mails about an unhandled error has occurred:
Message: A Potentially Dangerous Request.Form value was detected from the client (ctl00 $ default master content $ txtCustomerMessage ="... ???????? <a href = "http://aovo ...").

 Stack Trace:
   at System.Web.HttpRequest.ValidateString (String s, String Value name, String collection name)
   at System.Web.HttpRequest.ValidateNameValueCollection (name value collection nvc, String collection name)
   at System.Web.HttpRequest.get_Form ()
   at System.Web.HttpRequest.get_HasForm ()
   at System.Web.UI.Page.GetCollectionBasedOnMethod (Boolean dontReturnNull)
   at System.Web.UI.Page.DeterminePostBackMode ()
   at System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.AsyncPageProcessRequestBeforeAsyncPointCancellableCallback (Object state)
   at System.Web.HttpContext.InvokeCancellableCallback (wait callback callback, Object state)
   at System.Web.UI.Page.AsyncPageBeginProcessRequest (HttpC

A potentially dangerous Request.Form value was detected from the client


I am getting the above error when I am trying to save a value '<TS1'. I did the search and came to know it is about html injection. So I entered ValidateRequest="false" on top of the page and in the code behind file I have the following code.

Protected Sub fvAddCompass_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles fvAddCompass.ItemInserting

Dim strProvided A

How to get request.form working in masterpages?

Hi all,

On pages that use masterpages, request.form always return null. It works fine on pages without masterpage. Is this normal? How to use request.form in pages with masterpages?

Thanks in advance.

Request Failed Infopath Form


Hi All,

My requirment is to save infopath form values to sharepoint list.

I have created form and button for coding


 public void CTRL11_5_Clicked(object sender, ClickedEventArgs e)
            // Write your code here.
                XPathNavigator root = this.MainDataSource.CreateNavigator();
                string EmpID = root.SelectSingleNode(("/my:myFields/my:txtEmpID", NamespaceManager).Value;
                string EmpName = root.SelectSingleNode("/my:myFields/my:txtEmpName", NamespaceManager).Value;
                string EmpDesignation = root.SelectSingleNode("/my:myFields/my:ddlEmpDesignation", NamespaceManager).Value;

A potentially dangerous Request.Form value was detected from the client


We have a DOT.NET app that we paste info into. Sometimes the text contains characters which seem to offend dot.net. So the application breaks. How we intecept these breaks and then decide for ourselves if the content is really "potentially dangerous" or not?

The same string even breaks this "post a new message".

A potentially dangerous Request.Form value was detected from the client


i have 2 aspx files
1) 1.aspx - collects info from the user, stores into the DB.
2) 2.aspx - collects info from the DB and displays back to the user

in 2.aspx, i am encoding(htmlencode,urlencode.....) and displaying the info. so srcipt is displayed as text but not executed. -- expected result.
in 1.aspx, i am collecting info from textboxes and store in DB,i am getting below exception when clicked on save button.
"A potentially dangerous Request.Form value was detected from the client ...".

how do i fix it?
guys please dont tell me to turn off validaterequest.i want that to be turned ON, for security reasons.

also i want to validate the input before storing into the DB.so that my DB holds verified and trusted data(not malicious).

any help would be highly appreciated.

How to Create Auto increment Request number for browser enable infopath form field Programmatically?

hi all,

i have created an infopath which have one request no. field and it will auto increment when click on add new item on sharepoint Document library

field contains (highest value of column request no. +1 )  when infopath will open in browser.

What i have done on this:i have create new data connection on sharepoint library and then pick document library then choose ID field and insert function in the field max(ID)+1.

help me



A potentially dangerous Request.Form value was detected from the client in


Hi All, I have a MVC application and I am using a rich text box control in a textarea control. I have bind the page with the Model and fetching the data from the class properties. here is the textarea control to use the Text Editor

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend