[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

ASP.NET

124K

Solutions

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

Share tech news, updates, or what's on your mind.

Sign up to Post

ASP.Net Web Forms app (VB.Net code behind).   Novice/beginner in ASP

I am trying to set a heading at the top of my one page that will fill the width of the page.  Want it to look like this:
------------------------------------------------------------------------------------------------------------------------------------
MY TITLE  (label)                                                                    Company slogan =  (image file)
logo = (image file)
------------------------------------------------------------------------------------------------------------------------------------
The slogan and logo are not text, they are image files.   I will need to be able to size the space they occupy to make them the appropriate size.

I'd like the Solgan centered from the top to bottom.

I was hoping I could use an ASP.net Table control to align this.

Here is what I have, but not sure where to go from here:
<asp:Table ID="tblHeaderTitle" runat="server" BackColor="#76B54B" Height="80px" Width="100%">
             <asp:TableRow runat="server" Width="50%">
                 <asp:TableCell runat="server"></asp:TableCell>
                 <asp:TableCell runat="server"></asp:TableCell>
             </asp:TableRow>
             <asp:TableRow runat="server">

             </asp:TableRow>
</asp:Table>

Open in new window


Any advice how to do this?

Thanks,
0
C++ 11 Fundamentals
LVL 12
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Hi,

I have this webrequest looking like this:

 Public Sub SendFile(ByVal filename As String)
            coRequest = CType(WebRequest.Create(sURL), HttpWebRequest)
            coRequest.ProtocolVersion = TransferHttpVersion
            coRequest.Method = "POST"
            coRequest.ContentType = "multipart/form-data; boundary=" & BeginBoundary
            coRequest.Headers.Add("Cache-Control", "no-cache")
            coRequest.KeepAlive = True
            Dim strFields As String = GetFormfields()
            Dim strFileHdr As String = GetFileheader(filename)
            Dim strFileTlr As String = GetFiletrailer()
            Dim info As FileInfo = New FileInfo(filename)
            coRequest.ContentLength = strFields.Length + strFileHdr.Length + strFileTlr.Length + info.Length
            Dim io As System.IO.Stream
            io = GetStream()
            WriteString(io, strFields)
            WriteString(io, strFileHdr)
            Me.WriteFile(io, filename)
            WriteString(io, strFileTlr)
            GetResponse()
            io.Close()
            coRequest = Nothing
        End Sub

Open in new window


The GetResponse sub looks like this:
Public Overridable Sub GetResponse()
            If coFileStream Is Nothing Then
                Dim stream As Stream
                Dim response As WebResponse

                Try
                    response = coRequest.GetResponse()
                Catch web As WebException
                    response = web.Response
                End Try

                If response IsNot Nothing Then
                    stream = response.GetResponseStream()
                    Dim sr As StreamReader = New StreamReader(stream)
                    Dim str As String
                    ResponseText.Length = 0

                    For Each str In sr.ReadLine
                        ResponseText.Append(str)
                    Next

                    response.Close()
                Else
                    Throw New Exception("MultipartForm: Error retrieving server response")
                End If
            End If
        End Sub

Open in new window


The coRequest.ContentLength is 100507 and everything seems ok, but I get this error:
you must write contentlength bytes to the request stream before calling begin getresponse

Open in new window


I do the exact same in C#:

Open in new window

0
I have created a webapi using asp.net core, which uses token based authentication, all DB operations get implemented in the webapi, i also have roles set at the web api, i am able to send username and password from client to webapi and retrieve the token, i also need to get the role associated with account at the client and i want to use this role in Authorize attribute for methods, the Authroize is not working, i think the roles are not being read at the client. Can you assist.
0
Need a good asp.net PDF converter.

I store HTML in a database table field which we want to export to PDF. We've doing it with Telerik, but we'd like to get away from using that.

Any suggestions what we can use?

thanks!
0
Hi,

I have got
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResul

Open in new window

with these codes
            List<HouseData> houseList = new List<HouseData>();
            try
            {
                using (SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["Mssqlconn3"].ConnectionString))
                {
                    using (SqlCommand sqlCmd = new SqlCommand("SELECT cast(ROW_NUMBER() OVER (ORDER BY house_id ASC) as int) serial_id, house_id, rent_type, house_name, area, area_unit2, clicked_times, area_unit, area_size, isnull(construct_area_size,0) construct_area_size, isnull(request_times,0) request_times, release_period_from, CONVERT(varchar,register_date,105) register_date,CONVERT(varchar,upd_date,105) upd_date, address1, address2, price, price_curr, ltrim(rtrim(cast(raised_by_user_id as varchar))) raised_by_user_id FROM house_tab where isnull(raised_by_user_id,0)=@raiser and isnull(deleted,'')<>'Y'", sqlConn))
                    

Open in new window

0
I am using MVC 5 with entity framework version 6 and a SQL server database. I used the database first model to generate the model, controllers, and views.

I have a database with existing data. It has a list of customers and related meetings. One table contains the customers and the other table contains the meetings. One customer can have multiple meetings but a meeting is only associated with a single customer.

I want a link on the Customer details page to create a new meeting based on the ID of the customer in the details view.
 

Here is the code for the customer details view.
@model CRM.Models.Customer

@{
    ViewBag.Title = "Details";
}

<h2>Details</h2>

<div id="CustomerDetails">
    <h4>Customer</h4>
    <hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.SystemOfRecordId)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.SystemOfRecordId)
        </dd>
        <br />
        @*<dt>
                @Html.DisplayNameFor(model => model.Relationship)
            </dt>

            <dd>
                @Html.DisplayFor(model => model.Relationship)
            </dd>*@

        <dt>
            @Html.DisplayNameFor(model => model.Tin)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Tin)
        </dd>
        <br />
        <dt>
            @Html.DisplayNameFor(model => model.Name)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Name)
        

Open in new window

0
Hi, I have a blog website build using ASP.NET using C# and entity framework.
I have this requirement where I need to list all my published blogs and paginate them as they are too many.
I am new to .NET and have no idea how to do it.

Earlier I got all the blog details from the database and used ajax and JSON as well to fetch it.

A friend gave me a sample code and told me it would help. Please have a look into that as well.


Please help me acheive this.
I am attaching all my code here along with the stored procedure.


STORED PROCEDURE

GO
/****** Object:  StoredProcedure [dbo].[GetBlogs]    Script Date: 05-11-2018 01:50:14 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[GetBlogs]

@count int,
@start int,
@categoryId int,
@blogCount int Output
as
begin
	Declare @LastBlog int
	Set @count = 9
	Set @lastBlog = @count + @start;

	create table #x (id int identity(1,1),blogid int)

	if @categoryId is null
		begin
			insert into #x
			select Id from Blog where IsDeleted=0 and StatusId = 2

		end
	else
		begin
			insert into #x	
			select b.Id from Blog b inner join BlogCategories bc on b.Id = bc.BlogId where bc.CategoryId = @categoryId and b.IsDeleted=0 and b.StatusId = 2;
		end
	
	select @blogCount = COUNT(#x.id) from #x 

	select b.* from #x inner join Blog b on #x.blogid = b.Id where #x.id > @start and #x.id <= @LastBlog

	drop table #x

end

Open in new window




DAL Sample Code

using System;
using 

Open in new window

0
I have a WordPress site on my domain mydomain.com.  It works fine.
I have a simple ASP.NET project that I want to publish on the same domain, but in a sub-folder: mydomain.com/data.
How do I do this?  Each of the sections of the site (the WordPress section and the ASP.NET section) has their own web.config file.  So they have to coexist properly.
If I just transfer the published files for the ASP.NET section to mydomain.com/data and I go to  mydomain.com/data/WebForm1.aspx I just get Server error 404 page not found.  
Help!
0
HI Team,

Project :
MS VS ASP.Net MVC

I am looking for chart control which full fill below requirement.

I have to generate chart control with binding data from ms sql server database tables and with this generated chart need to save in database table with good quality of image so i can use in some annual reports pdf documents.

i have used Kendo UI line chart control have the option to save as either SVG or canvas. I switched it to canvas, which may have improved performance but the image, when retrieved from the database, was of lower quality and performance is very slow to generate for all my 700 companies chart.so i have chosen 50 companies per page to render then save in db and repeating same process until it reaches end of all companies but still performance and quality is not as good and sometime we observed some charts are drawn with empty data or half of data loaded and saving in db, this happens randomly and unable to figureout what problem is......

control i used as below:
https://demos.telerik.com/aspnet-mvc/line-charts

and The ASP.NET MVC version is just a wrapper around Kendo UI for jQuery
https://demos.telerik.com/kendo-ui/line-charts/index

so i am looking for any other chart control which can do my job as draw chart from binding data from tables and save chart images into table with good quality and good performance or how can i improve here

Please,I need your suggestion on this.
0
Hi,

I need to upload a file with a webrequest and combine it with some other form data in the request. Today my post request looks like this:

  Protected Function PostData(ByRef url As String, ByRef POST As String, ByRef Cookie As System.Net.CookieContainer) As String
        Dim request As HttpWebRequest
        Dim response As HttpWebResponse
        request = CType(WebRequest.Create(url), HttpWebRequest)
        request.ContentType = "application/x-www-form-urlencoded"
        request.ContentLength = POST.Length
        request.Method = "POST"
        request.AllowAutoRedirect = False

        Dim requestStream As Stream = request.GetRequestStream()
        Dim postBytes As Byte() = Encoding.ASCII.GetBytes(POST)
        requestStream.Write(postBytes, 0, postBytes.Length)
        requestStream.Close()
        response = CType(request.GetResponse, HttpWebResponse)
        Return New StreamReader(response.GetResponseStream()).ReadToEnd()
    End Function

Open in new window


The string post (in request.ContentLength)  now contains this form-data:
"access_token=xxyyzzz"

Open in new window


Now I want also to add this form data parameters:
file (a pdf file to upload)
recipient_email (string value)
recipient_name (string value)

How do I need to alter the PostData function to be able to post both the file and the string data in the webrequest?

Thanks for help!

Peter
0
OWASP Proactive Controls
LVL 12
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Hi,

I am using editable dropdown for searching or selecting records.

This will be working fine if we have less number of records (for example < 100 records).

if we have more than 1 million records, then it will not populate anything and it got struct.

i am using asp.net dropdown  with autocomplete jQuery.

How to solve this problem.?

sample code attached.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Combobox.aspx.cs" Inherits="Combobox.Combobox" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<style>
    .custom-combobox {
    position: relative;
    display: inline-block;
    height:35px;
    }
    .custom-combobox-toggle {
    position: absolute;
    top: 0;
    bottom: 0;
    margin-left: -1px;
    padding: 0;
    /* support: IE7 */
    *height: 1.7em;
    *top: 0.1em;
    }
    .custom-combobox-input {
    margin: 0;
    padding: 0.3em;
    background:#fff;
    outline:none;
    }
</style>
<script>
    (function ($) {
        $.widget("custom.combobox", {
            _create: function () {
                this.wrapper = $("<span>")
   

Open in new window

0
Update to Exchange 2013 Cumulative Update 20 fails with this error.
Error:
The following error was generated when "$error.Clear();
            $aspnet = [System.Runtime.InteropServices.RuntimeEnvironment]::GetRunTimeDirectory() + "aspnet_regiis.exe";
            Start-SetupProcess -name "$aspnet" -args "-ir -enable"
        " was run: "System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
   at Microsoft.Exchange.Configuration.Tasks.Task.ThrowError(Exception exception, ErrorCategory errorCategory, Object target, String helpUrl)
   at Microsoft.Exchange.Configuration.Tasks.Task.WriteError(Exception exception, ErrorCategory category, Object target)
   at Microsoft.Exchange.Management.Tasks.RunProcessBase.InternalProcessRecord()
   at Microsoft.Exchange.Configuration.Tasks.Task.<ProcessRecord>b__b()
   at Microsoft.Exchange.Configuration.Tasks.Task.InvokeRetryableFunc(String funcName, Action func, Boolean terminatePipelineIfFailed)".

Background:
One of clients I help sometimes happened to delete the W3SVC1 & W3SVC2 log files in order to create space on the C drive. Since then, the status of the databases are now unknown and half the services are not started. So I decided to upgrade to CU20 since I had been planning to do that all along.
0
Whats is the best too for Web services Testing Tool?
REST and API Testing
I'm planing to by Smart bear.Any idea is appreciated.
Company happy to pay for that.
0
i have used the linq code like the example below to construct a list of customers with the respective value,

Dim bunds As IEnumerable = (From dr In duse _
                     Group dr By a = dr.Field(Of Decimal)("msisdn") Into grp = Group Select New With
                            { _
                                .msisdn = a, _
                                .data_bytes_bundle = grp.Sum(Function(x) If(x.Field(Of Decimal)("bonus") = 1, x.Field(Of Decimal)("byts"), 0)),
                                .data_bytes_bonus = grp.Sum(Function(x) If(x.Field(Of Decimal)("bonus") = 2, x.Field(Of Decimal)("byts"), 0))
                            }).ToList

I have three list which i want to put into a single collectio using linq, it is failing at  o.msisdn with massage
Object variable or With block variable not set.

 Dim result = (From c In bunds
             Group Join o In core
             On c.msisdn Equals o.msisdn Into co = Group
             From o In co.DefaultIfEmpty() Join p In pcrf On o.msisdn Equals p.msisdn
             Select o.msisdn, o.data_bytes_bundle, o.data_bytes_bonus, o.data_bytes_core, p.byt_pcrf, p.byt_pcrf_bon).ToList

I am failing to get out of this
0
I'm quite new to this and need some help with a custom asp.net custom validator.

I have a function that adds a validator dynamically to an input. For checkboxes I have written a custom validator.

function AddValidator(controlId, validationMessage, isCheckBox = false) {
    if (typeof (Page_Validators) == 'undefined') return;
    // first remove validator so we do't add more than 1
    removeValidator(controlId);
    // Create new validator
    var newValidator = document.createElement('span');
    newValidator.style.display = "none";
    newValidator.display = "Dynamic";
    newValidator.id = "RequiredFieldValidator" + controlId;
    newValidator.controltovalidate = controlId;
    newValidator.errormessage = "<a href='#" + controlId + "_label' onclick='javascript:scrollToAndFocus(\"" + controlId + "_label\"" + ",\"" + controlId + "\");return false'>" + validationMessage + "is required.</a>";
    newValidator.validationGroup = ""; // Set this if you have set ValidationGroup on the form
    newValidator.initialvalue = "";
    newValidator.evaluationfunction = (isCheckBox == true) ? CheckBoxCheckedValidator : RequiredFieldValidatorEvaluateIsValid;
    Page_Validators.push(newValidator);
    $("#" + controlId + '_label').parent().removeClass('info');
    $("#" + controlId + '_label').parent().addClass('info required');
}

Open in new window


I then add the validator with this snippet
AddValidator($(this).attr("id"),"Validation Message ",true);

Open in new window


And the custom function is here:
function CheckBoxCheckedValidator()
{
return $(this).prop("checked") ;
}

Open in new window


What this is trying to do is to return false if the checkbox is not checked, and true if it is. But the control that is passed into this custom function is not the checkbox itself, rather it is the control created in the AddValidator function (i.e. RequiredFieldValidatorMyControlName )
So the question is, how do I get to the control itself, to check it's current checked status.
Thanks
0
I've integrated into a 3rd party java windows app which is forwarding messages via http post and get
They call it forwardURL, and its running locally so just hits http://127.0.0.1/etc

On the other side of this I have  multithreaded c# 4.6 console app which accepts the forwarded messages and saves them
I've noticed recently I've started to miss messages, and in one instance, there were 14 mins of messages missing

I'm trying to figure out the issue with logging etc, but wondered if there is a technology limit/server configuration limit (win 2016)
when I get to 30 messages a second, I've noticed messages start going missing.

Is there a limit that i'm unaware of, or some setting in the console app/windows that needs checking that might be responsible for these missing messages?
0
We use iTextSharp to create PDFs throughout our site.  We have a Comments field that can grow.
It doesn't look like iTextSharp supports dynamic attributes - or at least the way we are using it with a pre-defined template.

sample of the code for the comments section:

  stamper.AcroFields.SetField("Comments", sb.ToString());
  stamper.AcroFields.SetFieldProperty("Comments", "textsize", 6f, null);
0
Hi ,
For one of my client their AD structure is like
Domain architecture example :

•      xyz.com (Main Domain)
1.      abc.xyz.com (Subdomain)
      abc.xyz/User1  --> user in abc sub domain
      abc.xyz/User2  -->user in abc sub domain
      ADGrp1  --> Ad group in this abc domain
      ADGrp2  --> Ad group in this abc domain


2.      test.xyz.com (Subdomain)
    test.xyz/User3    --> user in test sub domain
   test.xyz/User4    --> user in test sub domain
    ADGrp3  --> Ad group in this test domain
    ADGrp4  --> Ad group in this test domain

Now problem arises when in my web.config ADGrop3 is configured and and ADGrp3 consist od cross sub domain abc.xyz\user1 and user is not getting acces.

 private List<string> GetGroups()
        {
                  List<string> groups = new List<string>();
                  if (string.IsNullOrEmpty(domainName)) return groups;
           
            using (PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, domainName))
            {
                try
                {
                    UserPrincipal user = UserPrincipal.FindByIdentity(principalContext, userName);
                    if (user != null)
                    {
                        PrincipalSearchResult<Principal> groupResults = user.GetGroups(principalContext);
                                    groups = getItems(groupResults);
                    }
                }
                catch (Exception ex)
                {
                    string errorMessage = "AD …
0
I have mvc / c# / razor app that using the following method / class and I found out our developer put this on Views/Shared/Layoutpage.
It looks like it is called this method everytime when the page is refreshed. As a result, it is super easy to max out the API usage.

My question is: What is the best practice to use cache in c# to reduce this usage? In general, the layoutpage will be loaded as usual.
Please show me how it works in codes/c#. Thanks

 public static string GetLatitiudeByIP(string ip)
        {
            string returnValue = "34.028623";
            XmlDocument foo = new XmlDocument();
            foo.Load(String.Format("http://api.ipstack.com/" + ip + "?access_key=7efaasdfasdfasdfadsf3829ad25d56ab30492c9c79d24f1&output=xml&legacy=1"));
            XmlNode latitudeNode = foo.SelectSingleNode("/result/latitude");
            if(latitudeNode != null)
            {
                returnValue = latitudeNode.InnerText;
            }
            return returnValue;
        }
0
Introduction to R
LVL 12
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Hi,
What can be reason to the below error, while it only happens when I deployed the same project to https (everything is fine if I deploy it to http)?

Server Error in '/RegRec2' Application.
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.]
   System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +258
   System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +497
   System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +100
   System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection 

Open in new window

0
I'm trying to debug an error in our C# Entity Framework code and would like some help trying to isolate the problem.

The code appears quite simple - it is updating a row in a table.

There exists a component test which runs this same code and it works.

However run from within ASP.NET the SaveChangesAsync() call just has a weird failure where no exception is thrown but the stack is cleared.
Let me just break that down a little:
The method that saves the changes works, but it is called using "await" and when I step through the debugger I never return to the original code that made the call. Similarly if I set a breakpoint it never hits any of the code after the await call.

If I then try to run a SELECT on the row the update was run on, I get a lock. When I reset IIS the transaction must rollback because the update isn't performed.

Things are complicated somewhat because the codebase I am using has various layers on top of the standard EF code which makes it difficult to share the code, however it looks like it is just using the following settings for the transaction

TransactionScopeOption.Required
TransactionScopeAsyncFlowOption.Enabled
IsolationLevel Serializable
Timeout 00:00:00

What could I do to try to isolate the cause of the problem?

I'm using Entity Framework 6.1.1
0
ASP.NET Core Web Client (RAZOR) Log In using AWS Cognito user pool and AWS .NET SDK to log in user in asp.net core web client

How to use AWS cognito user pool to authenticate and authorise ASP.NET Core WEb Client and ASP.NET Core Web API.

I already created a AWS Cognito User pool and App CLient.. I followed the below article from AWS

https://aws.amazon.com/blogs/mobile/use-csharp-to-register-and-authenticate-with-amazon-cognito-user-pools/

reached the point

      var cognito = new AmazonCognitoIdentityProviderClient(_region);
            //var cognito = new AmazonCognitoIdentityProviderClient(credentials);


            var request = new AdminInitiateAuthRequest
            {
                UserPoolId = _aWSConfig.PoolID,
                ClientId = _clientId,
                AuthFlow = AuthFlowType.ADMIN_NO_SRP_AUTH
            };

            request.AuthParameters.Add("USERNAME", "test@test.com");
            request.AuthParameters.Add("PASSWORD", "P@ssword12");

            var response = await cognito.AdminInitiateAuthAsync(request);

            return strToken = response.AuthenticationResult.AccessToken;

1. what are the next steps so that asp.net core web client is aware the user is logged in ??

example the below are set

User.Identity.IsAuthenticated

User.Identity.Name


User.Claims

2. what other details from token need to be stored where and how in ASPNET Client so that these can be used to send in HTTPCLient request …
0
I do not want my users to right in a iFrame and save the file onto the  computer.

I was able to control it on Chrome web browser but only version 60 and 64 versions of Chrome. I am able to right click in the iframe and save  the document in Internet Explorer and FIrefox browsers.

How can I disable right click in an iframe that display a PDF file or is there any way to ensure that the PDF file being viewed can disable the save/print options.
0
I have an aspx page with some input controls , along with an user control  ( see sample below).
I have some input in default.aspx page and some more in ascx page.

when I submit the form in default aspx page, I want to read the input values in that user entered in ascx page as well and save those along with the form values in the aspx page.
how can i save the input values from both default.aspx page and ascx control, all at once  ?

Default.aspx page ---

<%@ Register Src="~/WebUser.ascx" TagPrefix="uc1" TagName="WebUser" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
   
    <div class="row">
        <div class="col-md-6">
            <label>default text box</label>
             <asp:TextBox ID="txtusername" runat="server" ></asp:TextBox>
        </div>
      <div class="col-md-6">
          <uc1:WebUser runat="server" id="WebUser" />
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <asp:Button ID="savbtn" runat="server" text="save" OnClick="savbtn_Click"/>
        </div>
    </div>
</asp:Content>

WebUser.ascx page

<asp:textbox id="useremail" runat="server>
0
Iframe on a ASP.net Master page is giving me an error when I set to the Src property dynamically.

I have a website where the Master page has a Iframe defined. The idea is when ever the user choose a menu option, the  asp.net page to be open is set to the SRC property in the back end of the Master page file.

In the code behind, i am setting the value as follows:
    iMainFrame.Attributes.Add("Src", "http://www.google.com")

I am getting an error "Object reference not set to an instance of an object."

This issue happens only when I am using Master page and it works fine for a asp.net page with a Master file.

Any help is greatly appreciated.

Below is the master page definition.

   <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
           
              <asp:ContentPlaceHolder ID="MainContent" runat="server">
               
                     <iframe id="iMainFrame" src="SearchBuddy.aspx" style="border:none;width:100%;height:2200px;" runat="server" visible="true"></iframe>
                 </asp:ContentPlaceHolder>
       
           
        </div>

 
    </form>
0

ASP.NET

124K

Solutions

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications