|
I am calling pageMethod in codebehind of aspx page. I get the response for whole page instead of webMethod response. Also, I tried calling the same webMethod using jquery and got the whole page as response.
I am using .NET 4.5.1 and IIS7.5 and I think the issue is realted to in built extensionless URLS in VS2013
i am using the following sys.webserver config
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</modules>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
can any one send me correct configuration for ASPNET AJAX or Jquery ajax for .NET 4+ and IIS 7+
|
|
|
|
|
i want time table in Gridview...it have in the follwoing format
Date 1,Date 2 ...
Period
7.30-8.30 sub1
8.30-9.30
........
.........
if any one have an idea please share it
|
|
|
|
|
Use label or textbox controls for the "Date1, Date2, ...". Gridview consists of rows of data with some column headers. Here it is in vb (or did you want c#?)
Dim tbl As New DataTable
tbl.Columns.Add("Period", GetType(String))
tbl.Columns.Add("Item", GetType(String))
Dim entry As DataRow = tbl.NewRow
entry("Period") = "7.30-8.30"
entry("Item") = "sub1"
entry = tbl.NewRow
entry("Period") = "8.30-9.30"
entry("Item") = "sub2"
Me.GridView1.AutoGenerateColumns = True
Me.GridView1.DataSource = tbl
Me.GridView1.DataBind()
|
|
|
|
|
I have one!!! At 14:00 I will fetch some ice cream...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I am trying to call the following method (api/test?name=user1) but I keep getting the 'unsuccessful' response. I have tried debugging the method and found it crashes on the 'mes' unsuccessful line. there is data retrieved from the database in the result variable but on the client-end it keeps showing 'unsuccessful' message.
public HttpResponseMessage GetName(string name)
{
User layer = new User();
var result = layer.GetData(name);
if (result.username != null)
{
var mes = string.Format("unsuccessful");
return Request.CreateErrorResponse(HttpStatusCode.NotFound, mes);
}
else
{
return Request.CreateResponse(HttpStatusCode.OK, result);
}
}
Is their something I am missing?
Many thanks.
|
|
|
|
|
miss786 wrote: crashes on the 'mes' unsuccessful line
Crashes? How you get the unsuccessful answer if it crashes?!
From what you wrote it seems, that result.username is not null, so the unsuccessful branch is activated...
OT. Why var mes = string.Format("unsuccessful") and not mes = "unsuccessful"?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
miss786 wrote: if (result.username != null) Are you sure you have that test the right way round?
Veni, vidi, abiit domum
|
|
|
|
|
why does this function fails, with CipherMode.OFB where as it works with CipherMode.ECB
Public Function EncryptAES(sIn As String, sKey As String) As String
Dim AES As New RijndaelManaged()
Dim ahashMD5 As New MD5CryptoServiceProvider()
AES.Key = ahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
AES.Mode = CipherMode.OFB
Dim AESEncrypt As ICryptoTransform = AES.CreateEncryptor()
Dim aBuffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(sIn)
Return Convert.ToBase64String(AESEncrypt.TransformFinalBlock(aBuffer, 0, aBuffer.Length))
End Function
Error Message : Specified cipher mode is not valid for this algorithm.
Regards,
Vishal
|
|
|
|
|
Because the RijndaelManaged class doesn't support the OFB cipher mode. It only supports CBC , ECB and CFB .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
sir can you please guide which aes module for asp.net contains OFB cipher mode
Regards,
Vishal
|
|
|
|
|
There doesn't appear to be anything built-in to .NET which supports using AES in OFB mode. You'll need to find a third-party library to support that.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you
Regards,
Vishal
|
|
|
|
|
source code for sending sms in asp.net plz tell me
|
|
|
|
|
|
The gate way http://127.0.0.1 is not working plz give the currently running gateway
|
|
|
|
|
hiii!!! i want to fatch data in list box.. the selection based on dropdown list .. if we select value in drop down then required data will be fatch in list box.. the required data will be fatch accroding to userttype value ..the values of usertype=1,2. i m using 3 layer architecture...
my store procedure
USE [SCJ]
GO
/****** Object: StoredProcedure [dbo].[sp_sendmail] Script Date: 02/10/2014 12:34:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:<author,,name>
-- Create date: <create date,,="">
-- Description:<description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_sendmail]
-- Add the parameters for the stored procedure here
(
@usertype INT
--@emailid nvarchar(50)='',
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
BEGIN
-- Insert statements for procedure here
if(@usertype='usertype')
SELECT emailid from Login_User_Info where LTRIM(RTRIM(usertype)) = LTRIM(RTRIM(@usertype))
END
END
|
|
|
|
|
What's the problem? any error? struck where? Always include these details in your question.
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
I am Working on an ASP.Net website with c#.Net as Code Behind where I need to Call a phython script which does some business logic. Can anyone please tell me how to call a phython script from ASP.Net website.<u></u>
|
|
|
|
|
|
i want to set the menu items in center on hover event.
|
|
|
|
|
Hi I've been searching awhile but haven't found what I was looking for. I am trying to upload a file to SQL database using HTML5 <input type=file>. I have the html5 side done but am looking for a resource or example of server side code that will upload the file to a SQL server. I know I'll using httpwebrequest. Do I use a webservice (asmx file)? a handler (axhx file)? or something else?
Thank you!
John
|
|
|
|
|
A generic handler is probably the simplest option.
Use the Files property[^] of the context.Request object to read the uploaded files. This will return a collection of HttpPostedFile[^] objects. You can then use the InputStream property[^] to read the contents of the file.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard, I think I'm missing something. I created a generic handler .ashx file but "Files" is not a property of context.Request. The error message on "Files = HttpRequest.Files" is "Reference to non-shared member requires object" Here is my code...
Imports System.Web
Imports System.Web.Services
Public Class Handler1
Implements System.Web.IHttpHandler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim loop1 As Integer
Dim arr1() As String
Dim Files As HttpFileCollection
Files = HttpRequest.Files ' Load File collection into HttpFileCollection variable.
arr1 = Files.AllKeys ' This will get names of all files into a string array.
For loop1 = 0 To arr1.GetUpperBound(0)
context.Response.Write("File: " & Server.HtmlEncode(arr1(loop1)) & "<br>")
context.Response.Write(" size = " + Files(loop1).ContentLength + "<br />")
context.Response.Write(" content type = " + Files(loop1).ContentType + "<br />")
Next loop1
End Sub
ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
What I am missing?
|
|
|
|
|
As the error says, the Files property is not a Shared property; it's an instance property. You need to use context.Request.Files instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard! I figured it out!
for those curious, here is code that uses html5, jquery, javascript, and an asp.net handler to display selected image, upload image from client and save to SQL Server...
here is html..
<input type="file" id="upldFile" name="files[]" />
<input type="button" value="Add Sign" data-icon="plus" data-mini="true" id="btnAddSign">
here is javascript...
$('#upldFile').change(function (evt) {
var formData = new FormData();
var files = evt.target.files;
for (var i = 0, f; file = files[i]; i++) {
if (!file.type.match('image.*')) {
continue;
}
var thumbnail = URL.createObjectURL(file);
formData.append(file.name, file);
$('body').data('formdata', formData);
var span = document.createElement('span');
span.innerHTML = ['<img class="thumb" src="', thumbnail,
'" title="', escape(file.name), '"/>'].join('');
document.getElementById('list').insertBefore(span, null);
}
});
$('#btnAddSign').click(function () {
var xhr = new XMLHttpRequest();
var url = 'Handler1.ashx?requestid=' + $('body').data('requestid') + '&backcolor=' + $('#cmbBackColor').val() + '&textcolor=' + $('#cmbTextColor').val() + '&signshape=' + $('#cmbSignShape').val() + '&signsize=' + $('#cmbSignShape').val() + '&platematerial=' + $('#cmbPlateMaterial').val() + '&border=' + $('#sldBorder').val() + '&signtext=' + $('#txtSignText').val() + '&signquantity=' + $('#txtSignQuantity').val()
xhr.open('POST', url, true);
xhr.onload = function (e) {
};
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
GetItems();
}
}
xhr.send($('body').data('formdata'));
});
Here is handler.ashx
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim requestid As String = context.Request.QueryString("requestid").ToString
Dim backcolor As String = context.Request.QueryString("backcolor").ToString
Dim textcolor As String = context.Request.QueryString("textcolor").ToString
Dim signshape As String = context.Request.QueryString("signshape").ToString
Dim signsize As String = context.Request.QueryString("signsize").ToString
Dim platematerial As String = context.Request.QueryString("platematerial").ToString
Dim signtext As String = context.Request.QueryString("signtext").ToString
Dim signquantity As String = context.Request.QueryString("signquantity").ToString
Dim border As Boolean = context.Request.QueryString("border").ToString
Dim Files As HttpFileCollection
Files = context.Request.Files
Dim uploadFiles As HttpFileCollection = Files
For i = 0 To uploadFiles.Count - 1
Dim postedFile As HttpPostedFile = uploadFiles(i)
Dim inStream As System.IO.Stream = postedFile.InputStream
Dim fileData As Byte() = New Byte(postedFile.ContentLength - 1) {}
inStream.Read(fileData, 0, postedFile.ContentLength)
Dim cnInsert As New SqlConnection(GetConnectionString("MyConnectionString"))
Dim cmdInsert As New SqlCommand
Dim da As New SqlDataAdapter
Dim lastupdate As New DataTable
Dim ds As New DataSet()
cnInsert.Open()
cmdInsert.Connection = cnInsert
cmdInsert.CommandType = CommandType.StoredProcedure
cmdInsert.CommandText = "spSRQSignsCustomInsert"
cmdInsert.Parameters.AddWithValue("@pSignSize", signsize)
cmdInsert.Parameters.AddWithValue("@pSignBackColor", backcolor)
cmdInsert.Parameters.AddWithValue("@pSignShape", signshape)
cmdInsert.Parameters.AddWithValue("@pSignText", signtext)
cmdInsert.Parameters.AddWithValue("@pSignQuantity", signquantity)
cmdInsert.Parameters.AddWithValue("@pSignTextColor", textcolor)
cmdInsert.Parameters.AddWithValue("@pBorder", border)
cmdInsert.Parameters.AddWithValue("@pPlateMaterial", platematerial)
cmdInsert.Parameters.AddWithValue("@pRequestID", requestid)
cmdInsert.Parameters.AddWithValue("@pRequestedImage", fileData)
cmdInsert.ExecuteNonQuery()
cnInsert.Close()
Next
End Sub
|
|
|
|